Q:

Write a C# program to find the largest and lowest values from three integer values

0

Write a C# program to find the largest and lowest values from three integer values

Sample Output:

Input first integer:                                                   
15                                                                     
Input second integer:                                                  
25                                                                     
Input third integer:                                                   
30                                                                     
Largest of three: 30                                                   
Lowest of three: 15

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
public class Exercise39 {
static void Main(string[] args)
        {
Console.WriteLine("\nInput first integer:");  
int x = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Input second integer:");  
int y = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Input third integer:");  
int z = Convert.ToInt32(Console.ReadLine());
              
Console.WriteLine("Largest of three: "+Math.Max(x, Math.Max(y, z)));
Console.WriteLine("Lowest of three: "+Math.Min(x, Math.Min(y, z)));
        }
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now