Advertisement
InnaSibirova

Nur 6

Dec 21st, 2021
1,142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.55 KB | None | 0 0
  1.  
  2. #include <stdio.h>
  3.  
  4. int main()
  5. {
  6.     int n;
  7.     int arr[1000];
  8.     printf("vvedite razmer massiva");
  9.     scanf("%d", &n);
  10.     printf("zapolnite massive");
  11.     scanf("%d", &arr[0]);
  12.     int max = arr[0], maxi = 0;
  13.     for(int i = 1; i < n; i += 1) {
  14.         scanf("%d", &arr[i]);
  15.         if(arr[i] > max) {
  16.             max = arr[i];
  17.             maxi = i;
  18.         }
  19.     }
  20.     for(int i = maxi; i < n-1; i += 1) {
  21.         arr[i] = arr[i+1];
  22.     }
  23.     for(int i = 0; i < n - 1; i += 1) {
  24.         printf("%d ", arr[i]);
  25.     }
  26.     return 0;
  27. }
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement