Write a program that find the smallest number
Write a program that determines which three numbers entered is the smallest.
Algorithm for the three Numbers:
- Go to File, New -> Project, select window Classic Desktop ->Console App (.net Framework).
- Console App created.
- Start writing a code of these three numbers below the static void and in between the middle bracket.
- Take three number for declare the smallest number.
- To Apply the If/Else logic.
- Find the smallest number from the three numbers.
- Display the smallest number.
- Code is shown below.
C# Program Code:
{` using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApp10 &lbrace className Smallest &lbrace public static void Main() &lbrace int n1, n2, n3; Console.WriteLine("Enter Three number by entering vertically:"); n1 = Convert.ToInt32(Console.ReadLine()); n2 = Convert.ToInt32(Console.ReadLine()); n3 = Convert.ToInt32(Console.ReadLine()); if (n1 < n2) if (n1 < n3) &lbrace Console.WriteLine("The Smallest Of Three numbers are:" + n1); &rbrace else &lbrace Console.WriteLine("The Smallest Of Three numbers are:" + n3); &rbrace else if (n2 < n3) &lbrace Console.WriteLine("The Smallest Of Three numbers are:" + n2); &rbrace else &lbrace Console.WriteLine("The Smallest Of Three numbers are:" + n3); &rbrace &rbrace &rbrace &rbrace `}