Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ArrayLocalMax
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[] array = { 9, 5, 4, 3, 4, 5, 3, 4, 5, 4, 5, 4, 3, 7, 8, 9, 7, 6, 7, 6, 4, 6, 4, 5, 3, 5, 3, 5, 3, 5 };
- for (int i = 1; i < array.Length - 1; i++)
- {
- if(array[i]>array[i-1]&& array[i] > array[i + 1])
- {
- Console.Write(array[i] + " ");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement