Created
September 27, 2021 11:04
-
-
Save Ana19997/3f6e9d56b4303f1ed5c58a4d84804db0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace ConsoleApp11 | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
int[] array = new int[30]; | |
Random random = new Random(); | |
for (int i = 0; i < array.Length; i++) | |
{ | |
array[i] = random.Next(30); | |
Console.WriteLine(array[i]); | |
} | |
if(array[0] > array[1]) | |
{ | |
Console.WriteLine($"\nПервый крайний элемент {array[0]}"); | |
} | |
for (int i = 1; i < array.Length - 1; ++i) | |
{ | |
if (array[i - 1] < array[i] && array[i + 1] < array[i]) | |
{ | |
Console.WriteLine("\nЛокальные максимумы " + array[i]); | |
} | |
} | |
if (array[array.Length - 1] > array[array.Length - 2]) | |
{ | |
Console.WriteLine($"\nПоследний крайний элемент {array[array.Length - 1]}"); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment