Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void Main(string[] args)
- {
- Random random = new Random();
- int minNumber = 1;
- int maxNumber = 10;
- int countElement = 30;
- int[] array = new int[countElement];
- Console.WriteLine("Массив:");
- for (int i = 0; i < array.Length; i++)
- {
- array[i] = random.Next(minNumber, maxNumber);
- Console.Write(array[i] + " ");
- }
- Console.WriteLine();
- if (array[0] > array[1])
- Console.Write(array[0] + " ");
- else
- Console.Write(" ");
- for (int i = 1; i < array.Length - 1; i++)
- {
- if (array[i - 1] < array[i] && array[i + 1] < array[i])
- Console.Write(array[i] + " ");
- else
- Console.Write(" ");
- }
- if (array[array.Length - 2] < array[array.Length - 1])
- Console.Write(array[array.Length - 1] + " ");
- else
- Console.Write(" ");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement