Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace CSLight11
- {
- internal class Program
- {
- private static void Main(string[] args)
- {
- Random rand = new Random();
- int[] array = new int[30];
- for (int i = 0; i < array.GetLength(0); i++)
- {
- array[i] = rand.Next(0, 50);
- Console.Write(array[i] + " ");
- }
- if(array[0] > array[1])
- {
- Console.WriteLine("\n" + array[0] + " - локальный максимум");
- }
- for (int i = 1; i < array.Length - 1; i++)
- {
- if (array[i] > array[i - 1] && array[i] > array[i + 1])
- {
- Console.WriteLine(array[i] + " - локальный максимум.");
- }
- }
- Console.WriteLine(array[array.Length]);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement