Greater or Small number program in C#

C# program to find whether a number is greater or small.

Source code - Greater or small number program in Console(C#).


    using System;
    using System.Collections.Generic;
    using System.Text;

    namespace greater
    {
        class Program
        {
            static void Main(string[] args)
            {
                int a, b, c;
                //Greater Number ---- Comparing with three values
                Console.WriteLine("ENTER THE VALUE OF A :- ");
                a = Convert.ToInt32(Console.ReadLine());
                Console.WriteLine("ENTER THE VALUE OF B :- ");
                b = Convert.ToInt32(Console.ReadLine());
                Console.WriteLine("ENTER THE VALUE OF C :- ");
                c = Convert.ToInt32(Console.ReadLine());
                if (a > b && a > c)
                {
                    Console.WriteLine("A IS GREATER FROM ALL NUMBERS.");
                }
                else if (b > a && b > c)
                {
                    Console.WriteLine("B IS GREATER FROM ALL NUMBERS.");
                }
                else if (c > a && c > b)
                {
                    Console.WriteLine("C IS GREATER FROM ALL NUMBERS.");
                }
                else
                {
                    Console.WriteLine("ALL NUMBER ARE EQUAL.");
                }
                Console.ReadLine();
            }
        }
    }
	
	

Output

	
   ENTER THE VALUE OF A :- 5
   ENTER THE VALUE OF B :- 6
   ENTER THE VALUE OF C :- 2
          
   B IS GREATER FROM ALL NUMBERS.
           
Advertisement here

Share this Page.