C# .Net Program to find maximum Number from three number using Conditional operator

C# .Net Program to find maximum Number from three number using Conditional operator

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

            d= (a > b && a>c) ? a : (b>a && b>c) ? b: c;

            Console.WriteLine("Maximum Number is: =" + d);
        }
    }
}

Output : To see Output Run the Program
Previous
Next Post »