Skip to content

Instantly share code, notes, and snippets.

@Ana19997
Created September 27, 2021 10:41
Show Gist options
  • Save Ana19997/b9b1ee8eea95bed10cbd94740b89af18 to your computer and use it in GitHub Desktop.
Save Ana19997/b9b1ee8eea95bed10cbd94740b89af18 to your computer and use it in GitHub Desktop.
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]);
}
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