C# to Find Maximum number from three number using if else condition

C# to Find Maximum number from three number using if else condition

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

 

Previous
Next Post »