2
22/10/2024 2:14 pm
Inicio del tema
Write an if-statement that takes two integer variables a and b and exchanges their values if the first one is greater than the second one. As a result print the values a and b, separated by a space.
Examples:

1 respuesta
2
22/10/2024 2:15 pm
Here's how I did this task:
using System;
class ExchangeIfGreater
{
static void Main()
{
decimal a = decimal.Parse(Console.ReadLine());
decimal b = decimal.Parse(Console.ReadLine());
if (a > b)
{
Console.WriteLine("{0} {1}", b, a);
}
else
{
Console.WriteLine("{0} {1}", a, b);
}
}
}
