Hello, I’m working on this task:
Write a program that reads two numbers from the console and then outputs the lesser of the two numbers. Use a short (one line) version to read a string from the console and convert it to int .
For example:
>123
>97
97
Here is my code:
namespace ConsoleInput
{
public class TheMinimum
{
public static void Main(string[] args)
{
int a = int.Parse(Console.ReadLine());// Read a line and convert it to int (short version)
int b = int.Parse(Console.ReadLine());// Read a line and convert it to int (short version)
if (a > b)
{
Console.WriteLine({b});
}
else (a < b)
{
Console.WriteLine({a});
}
}
}
}
Can anyone please help me to solve it?