Advertisement
Josif_tepe

Untitled

Feb 7th, 2022
1,156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.35 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main(){
  4.     int n, i, a[100], m;
  5.  
  6.     printf("Vnesete n\n");
  7.     fflush(stdout);
  8.     scanf("%d", &n);
  9.  
  10.     for(i=0; i<n; i++)
  11.         scanf("%d", &a[i]);
  12.  
  13.     scanf("%d", &m);
  14.  
  15.     int b[100];
  16.  
  17.     for(i=0; i<n; i++){
  18.  
  19.         if(i-m<0)
  20.         b[i-m+n]=a[i];
  21.  
  22.         else
  23.             b[i-m]=a[i];
  24.     }
  25.  
  26.     for(i=0; i<n; i++)
  27.     printf("%d ", b[i]);
  28.  
  29.  
  30.     return 0;
  31. }
  32.  
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement