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