Tuesday, October 15, 2013

//Author: Suresh Babu
//To find the biggest number in array (Single dimentional)

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

namespace ConsoleApplication15
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] arr1 = new int[5];
            for (int y = 0; y < arr1.Length; y++)
            {
                arr1[y] = int.Parse(Console.ReadLine());
            }
            int x = arr1.Max();
            Console.WriteLine("The biggest number of array is" + x);
        }
    }
}
           
                     
           

           
               
       


//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);
            }
               
        }
    }
}