Created
September 26, 2021 11:58
-
-
Save Ana19997/9d317fbcd24a576815c6b802d0153cb0 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 rand = new Random(); | |
for (int i = 0; i < array.Length; i++) | |
{ | |
array[i] = rand.Next(30); | |
Console.WriteLine(array[i]); | |
} | |
if(array[0] > array[1]) | |
{ | |
Console.WriteLine($"\nПервый элемент {array[0]}"); | |
} | |
if (array[array.Length - 1] > array[array.Length - 2]) | |
{ | |
Console.WriteLine($"\nПоследний элемент {array[array.Length - 1]}"); | |
} | |
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]); | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment