Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp3
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- int size = 30;
- int[] matrix = new int[size];
- Random random = new Random();
- int randomMaxRange = 10;
- int randomMinRange = 0;
- int step = 1;
- int startPosition = 0;
- for (int i = 0; i < size; i++)
- {
- matrix[i] = random.Next(randomMinRange, randomMaxRange);
- }
- if (matrix[startPosition] > matrix[startPosition + step])
- {
- Console.BackgroundColor = ConsoleColor.Green;
- Console.Write(matrix[startPosition]);
- Console.ResetColor();
- Console.Write(" ");
- }
- for (int i = 0; i < size; i++)
- {
- if (i > 0 && i != matrix.Length - step && matrix[i] > matrix[i + step] && matrix[i] > matrix[i - step])
- {
- Console.BackgroundColor = ConsoleColor.Green;
- Console.Write(matrix[i]);
- Console.ResetColor();
- Console.Write(" ");
- }
- Console.Write(matrix[i] + " ");
- }
- if (matrix[matrix.Length - step] > matrix[matrix.Length - step - step])
- {
- Console.BackgroundColor = ConsoleColor.Green;
- Console.Write(matrix[matrix.Length - step]);
- Console.ResetColor();
- Console.Write(" ");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement