Loading
View RSS Feed

angad

Dot Net Code: Write A Program To Find Minimum Among Three Numbers

Rate this Entry
Code:
//CONTEXT:-TO FIND THE MINIMUM AMONG THREE NUMBERS
//ASSUMPTION:-NONE;
//CONTRACT:-"Min(int,int,int)->int"
//EXAMPLE:-Min(3,2,1)->1,Min(87,6,76)->6
//SPECIAL CONSIDERATION:-NONE
/*PSUEDO CODE:-"Min(a,b,c)
 *              {
                    int min = b > c ? c : b;
                    int min1 = a > min ? min : a;
                    return min1;
                  }*/
/*TEST CASES:-      INPUT       EXPECTED         ACTUAL           STATUS 
 *                  (2,3,4)         2               2            Satisfied
 *                  (1,6,8)         1               1            Satisfied
 */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace minimum
{
    class Program
    {
        static int Min(int a, int b, int c)
        {
            int min = b >= c ? c : b;
            int min1 = a >= min ? min : a;
            return min1;
        }

        static void Main(string[] args)
        {
            Console.WriteLine("ENTER 3 NOS");
            int x=int.Parse(Console.ReadLine());
            int y=int.Parse(Console.ReadLine());
            int z=int.Parse(Console.ReadLine());
            int minimum = Min(x, y, z);
            Console.WriteLine("MINIMUM OF ALL IS=" + minimum);
            Console.Read();
        }
    }
}

Submit "Dot Net Code: Write A Program To Find Minimum Among Three Numbers" to Digg Submit "Dot Net Code: Write A Program To Find Minimum Among Three Numbers" to del.icio.us Submit "Dot Net Code: Write A Program To Find Minimum Among Three Numbers" to StumbleUpon Submit "Dot Net Code: Write A Program To Find Minimum Among Three Numbers" to Google

Tags: asp, dot net Add / Edit Tags
Categories
ASP .Net

Comments

Leave Comment Leave Comment