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);
- }
- for (int i = 0; i < 30; i++)
- {
- switch (i)
- {
- case 0:
- if (array[i] > array[i + 1])
- {
- Console.ForegroundColor = ConsoleColor.Red;
- Console.Write(array[i] + " ");
- Console.ForegroundColor = ConsoleColor.White;
- }
- else
- {
- Console.Write(array[i] + " ");
- }
- break;
- default:
- 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] + " ");
- }
- break;
- case 29:
- if (array[i] > array[i - 1])
- {
- Console.ForegroundColor = ConsoleColor.Red;
- Console.Write(array[i] + " ");
- Console.ForegroundColor = ConsoleColor.White;
- }
- else
- {
- Console.Write(array[i] + " ");
- }
- break;
- }
- }
- Console.WriteLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement