Finding the biggest of three numbers in C#

Write C# program to find the largest of three numbers using if else statement

C# Code :

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MaxNum3
{
class Program
{
static void Main(string[] args)
{
int a, b, c;
Console.WriteLine(“Enter the Number A:“);
a = Convert.ToInt32(Console.ReadLine());
Console.WriteLine(“Enter the Number B:“);
b = Convert.ToInt32(Console.ReadLine());
Console.WriteLine(“Enter the Number C:“);
c = Convert.ToInt32(Console.ReadLine());

if (a > b && a > c)
{
Console.WriteLine(“A is Max“);
}
else if (b > a && b > c)
{
Console.WriteLine(“B is Max“);
}
else
{
Console.WriteLine(“C is Max“);
}
}
}
}

OUTPUT : Run the Console application and See the Output

6 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *