Нужно написать решение на C# Даны 8 различных чисел. Определить максимальное из них, используя функцию определения максимального из двух чисел.

archik4 archik4    2   14.06.2021 11:54    4

Ответы
Girl1girl Girl1girl  14.06.2021 12:00

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);

       }

   }

}

ПОКАЗАТЬ ОТВЕТЫ
Другие вопросы по теме Информатика