To write a C# program to find the largest of three numbers
Start
Create a class and declare three variable with integer datatype
Use if condition to check whether num1 is largest than num2 and num3
Use elif condition to check whether num2 is largest than num1 and num3
Use else condition to display that third variable is largest among all the variables
stop
using System;
namespace largestnum
{
class Program
{
static void Main(string[] args)
{
int num1, num2, num3;
num1 = Convert.ToInt32(Console.ReadLine());
num2 = Convert.ToInt32(Console.ReadLine());
num3 = Convert.ToInt32(Console.ReadLine());
if(num1 > num2 && num1 > num3)
{
Console.WriteLine("The Largest Number is " + (num1));
}
else if(num2 > num1 && num2 > num3)
{
Console.WriteLine("The Largest Number is " + (num2));
}
else
{
Console.WriteLine("The Largest Number is " +(num3));
}
}
}
}
Thus the C# program to find the largest of three numbers is executed successfully