CSharp - Write program to Get the Minimum with Built-in Math Function

Requirements

You can get the Minimum value of three value using the Math.Min function.

Demo

using System;
class Program/* w  ww .  j  a  v a2 s.co  m*/
{
    static void Main(string[] args)
    {
        // Inputs 
        Console.Write("Enter 1. number: ");
        string input1 = Console.ReadLine();
        int number1 = Convert.ToInt32(input1);

        Console.Write("Enter 2. number: ");
        string input2 = Console.ReadLine();
        int number2 = Convert.ToInt32(input2);

        Console.Write("Enter 3. number: ");
        string input3 = Console.ReadLine();
        int number3 = Convert.ToInt32(input3);

        // Evaluating 
        int min12 = Math.Min(number1, number2);
        int minimum = Math.Min(min12, number3);

        // Output 
        Console.WriteLine("The least of entered numbers is " + minimum);
    }
}

Result