Advertisement
dmitryEfremov

Untitled

Apr 15th, 2020
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.47 KB | None | 0 0
  1. using System;
  2. namespace ConsoleApp5
  3. {
  4.     class Program
  5.     {
  6.         static void Main(string[] args)
  7.         {
  8.             int[] array = new int[5];
  9.             Console.WriteLine("Заполните массив:");
  10.             for (int i = 0; i < array.Length; i++)
  11.             {
  12.                 array[i] = Convert.ToInt32(Console.ReadLine());
  13.             }
  14.             Console.WriteLine("Вы заполнили массив:");
  15.             for (int i = 0; i < array.Length; i++)
  16.             {
  17.                 Console.WriteLine(array[i] + " ");
  18.             }
  19.  
  20.             if (array[0] >= array[1])
  21.             {
  22.                 Console.Write(array[0] + " - ЛМ ");
  23.             }
  24.             else
  25.             {
  26.                 Console.Write(array[0] + " - Не ЛМ ");
  27.             }
  28.             for (int i = 1; i <= array.Length - 2; i++)
  29.             {
  30.                 if (array[i] < array[i - 1] || array[i] < array[i + 1])
  31.                 {
  32.                     Console.Write(array[i] + " - Не ЛМ ");
  33.                 }
  34.                 else
  35.                 {
  36.                     Console.Write(array[i] + " - лм ");
  37.                 }
  38.  
  39.             }
  40.             if (array[array.Length - 1] >= array[array.Length - 2])
  41.             {
  42.                 Console.Write(array[array.Length - 1] + " - Лм ");
  43.             }
  44.             else
  45.             {
  46.                 Console.Write(array[array.Length-1] + " - не лм ");
  47.             }
  48.         }
  49.     }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement