Find the greatest number between the three number.

Discussion in 'C#' started by Patel, May 22, 2011.

  1. Patel

    Patel New Member

    Joined:
    Dec 5, 2010
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Student
    Location:
    Lucknow
    Code:
    using System;
    using System.Collections.Generic;
    using System.Text;
    
    namespace greatestno
    {
        class Program
        {
            
            static void Main(string[] args)
            {
            int num1, num2, num3;
            Console.WriteLine("Enter the num1");
            num1=Int32.Parse(Console.ReadLine());
            Console.WriteLine("Enter the num2");
            num2 = Int32.Parse(Console.ReadLine());
            Console.WriteLine("Enter the num1");
            num3 = Int32.Parse(Console.ReadLine());
            if (num1 >num2)
                if (num1 > num3)
                    Console.WriteLine("Num1 is the greatest no. :");
                else
                    Console.WriteLine("Num3 is the greatest no. :");
            else
                if (num2 > num3)
                    Console.WriteLine("Num2 is the greatest no. :");
                else
                    Console.WriteLine("Num3 is the greatest no. :");
            Console.ReadLine();
            }
        }
    }
     
    Last edited by a moderator: May 22, 2011

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice