С помощью if найти максимальное из четырех чисел
С помощью if найти максимальное из четырех чисел
Ответ(ы) на вопрос:
int a1 = int.Parse(Console.ReadLine());
int a2 = int.Parse(Console.ReadLine());
int a3 = int.Parse(Console.ReadLine());
int a4 = int.Parse(Console.ReadLine());
int max = a1;
if (max < a2)
{
max = a2;
}
if (max < a3)
{
max = a3;
}
if (max < a4)
{
max = a4;
}
Console.WriteLine(max);
Console.ReadLine();
Не нашли ответ?
Похожие вопросы