View Code of Problem 79

#include<stdio.h>
int main(){
    int n;
    scanf("%d",&n);
    int a[100],b[100];
    for (int i = 0; i <n ; i++) {
        scanf("%d",&a[i]);
    }
    int k=0;
    int s;
    scanf("%d",&s);
    for (int j = 0; j <n ; j++) {
        b[(j+s)%n]=a[j];
    }
    for (k = 0; k<n-1 ; k++) {
        printf("%d ",b[k]);
    }
    printf("%d",b[n-1]);
    return 0;
}

Double click to view unformatted code.


Back to problem 79