Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace HelloApp
- {
- class Program
- {
- static void Main(string[] args)
- {
- Random number = new Random();
- int[] array = new int[30];
- for (int i = 0; i < 30; i++)
- {
- array[i] = number.Next(1, 100);
- }
- if (array[0] > array[1])
- {
- Console.ForegroundColor = ConsoleColor.Red;
- Console.Write(array[0] + " ");
- Console.ForegroundColor = ConsoleColor.White;
- }
- else
- {
- Console.Write(array[0] + " ");
- }
- for (int i = 1; i < 29; i++)
- {
- if (array[i] > array[i - 1] && array[i] > array[i + 1])
- {
- Console.ForegroundColor = ConsoleColor.Red;
- Console.Write(array[i] + " ");
- Console.ForegroundColor = ConsoleColor.White;
- }
- else
- {
- Console.Write(array[i] + " ");
- }
- }
- if (array[array.Length-1] > array[array.Length-2])
- {
- Console.ForegroundColor = ConsoleColor.Red;
- Console.Write(array[array.Length - 1] + " ");
- Console.ForegroundColor = ConsoleColor.White;
- }
- else
- {
- Console.Write(array[array.Length - 1] + " ");
- }
- Console.WriteLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement