Tuesday, October 15, 2013


//Author: Suresh Babu
//Use of if and else to find the biggest of three numbers


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

namespace ConsoleApplication14
{
    class Program
    {
        static void Main(string[] args)
        {
            int x, y, z;
            x = int.Parse(Console.ReadLine());
            y = int.Parse(Console.ReadLine());
            z = int.Parse(Console.ReadLine());
            if (x > y && x > z)
            {
                Console.WriteLine("The value of x is {0} is greater than both y and z", x);
            }
            else if (y > x && y > z)
            {
                Console.WriteLine("The value of y is {0} is greater than both x and z", y);
            }
            else
            {
                Console.WriteLine("The value of z is {0} is greater than both x and y", z);
            }
               
        }
    }
}

No comments:

Post a Comment