Нужно написать решение на C#
Даны 8 различных чисел. Определить максимальное из них, используя функцию определения максимального из двух чисел.
Ответы
Ответ:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
int a= Int32.Parse(Console.ReadLine());
int b = Int32.Parse(Console.ReadLine());
int c = Int32.Parse(Console.ReadLine());
int d = Int32.Parse(Console.ReadLine());
int e = Int32.Parse(Console.ReadLine());
int f = Int32.Parse(Console.ReadLine());
int g = Int32.Parse(Console.ReadLine());
int h = Int32.Parse(Console.ReadLine());
b = Math.Max(a, b);
c = Math.Max(b, c);
d = Math.Max(c, d);
e = Math.Max(d, e);
f = Math.Max(e, f);
g = Math.Max(f, g);
h = Math.Max(g, h);
Console.WriteLine(h);
}
}
}


Чтобы автоматически закрывать консоль при остановке отладки, включите параметр "Сервис" ->"Параметры" ->"Отладка" -> "Автоматически закрыть консоль при остановке отладки".
Нажмите любую клавишу, чтобы закрыть это окно…