Advertisement
POdkovyrkinDaniil

Untitled

Jun 12th, 2025
11
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. using System;
  2.  
  3. namespace System
  4. {
  5. class Class
  6. {
  7. static void Main(string[] args)
  8. {
  9. int = arraySize = 30;
  10. int[] numbers = new int[arraySize];
  11. int minValueBorder = 0;
  12. int maxValueBorder = 15;
  13. Random generator = new Random();
  14. int lastIndex = numbers.length - 1;
  15.  
  16. for (int i = 0; i < array.Length; i++)
  17. {
  18. array[i] = generator.Next(minValueBorder, maxValueBorder + 1);
  19. Console.Write(numbers[i] + " ");
  20. }
  21.  
  22. Console.WriteLine();
  23.  
  24. if (numbers[0] > numbers[1])
  25. Console.Write(numbers[0] + " ");
  26.  
  27. for (int j = 1; j < lastIndex; j++)
  28. {
  29. if (numbers[j-1] < numbers[j] && numbers[j] > numbers[j+1])
  30. Console.Write(numbers[j] + " ");
  31. }
  32.  
  33. if (array[lastIndex] > numbers[lastIndex - 1])
  34. Console.Write(numbers[lastIndex]);
  35. }
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement