C# .Net Find Maximum Number From Two number using conditional operator

C# .Net Find Maximum Number From Two number using Conditional operator

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b, c;
            Console.WriteLine("Enter value of A:");
            a = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("Enter value of B:");
            b = Convert.ToInt32(Console.ReadLine());
            c = (a > b) ? a : b;
            Console.WriteLine("Maximum Number is: ="+c);
        }
    }
}

 OUTPUT : Run the programe and see the Output
Previous
Next Post »