CSharp - Write program to Get the Minimum of Three Numbers

Requirements

You will write a program that finds the smallest of three numbers entered by the user.

Demo

using System;
class Program//w w  w.  jav a  2  s  .c  o 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);

        // At the beginning, we set 1st number as minimum 
        int minimum = number1;

        // Is not 2nd number less than present minimum? 
        if (number2 < minimum)
        {
            minimum = number2;
        }

        // Is not 3rd number less than present minimum? 
        if (number3 < minimum)
        {
            minimum = number3;
        }

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

    }
}

Result