Finding Greatest Number
//Greatest Number
Console.WriteLine("Enter First number");
int a = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter Second number");
int b = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter Third number");
int c = Convert.ToInt32(Console.ReadLine());
if (a == b && a == c)
{
Console.WriteLine("All numbers are same, nothing to compare");
}
else if (a > b && a > c)
{
Console.WriteLine("First Number is Greatest");
}
else if (b > a && b > c)
{
Console.WriteLine("Second Number is Greatest");
}
else
{
Console.WriteLine("Third Number is Greatest");
}
Console.ReadLine();
No comments:
Post a Comment