Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program that inputs two numbers anddetermines which of the two numbers i

ID: 3625974 • Letter: W

Question

Write a program that inputs two numbers anddetermines which of the two numbers is the smallest. If the numbers are equal, display a message that they are equal.

Sample Output from Program:

You will be asked to enter two numbers.
The smallest value will be displayed or a message if they are the same.

Please enter a numeric value: 4
Please enter a numeric value: 7

The smallest value is 4
Press any key to continue...


Using the pseudocode below, write the code that will meet the requirments:

Display discription of program

Prompt the user for the first number

Prompt the user for the second number

If fist number equals second number

Display the two numbers that are equal

Else

If the first number is greater than the second number

Assign second number to the smallest

Else

Assign first number to smallest

End-If

Display smallest number

End-If



Explanation / Answer

 

Dear,

Updated with C# code

Program to find the smallest number among the two numbers.

static void Main(string[] args)
{

int smallest, number1, number2;
Console.Write("Enter First Number: ");
number1 = int.Parse(Console.ReadLine());
Console.Write("Enter Secnd Number: ");
number2 = int.Parse(Console.ReadLine());
Console.WriteLine(" ");

if (number1 == number2 )
Console.WriteLine("Two Numbers are equal ");
else
{
if(number1>number2)
smallest=number2;
else
smallest=number1;
Console.WriteLine("Smallest Number is "+smallest.ToString());
}

Console.Read();
}

 

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote