You are viewing a single comment's thread. Return to all comments →
#include <math.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <assert.h> #include <limits.h> #include <stdbool.h> int main(){ int n; int k,p=0; scanf("%d %d",&n,&k); int *a = malloc(sizeof(int) * n); for(int a_i = 0; a_i < n; a_i++){ scanf("%d",&a[a_i]); } for(int i=0;i<n;i++) { if(i+k>n-1) { printf("%d ",a[p]); p++; } else printf("%d ",a[i+k]); } return 0; }
Seems like cookies are disabled on this browser, please enable them to open this website
Arrays: Left Rotation
You are viewing a single comment's thread. Return to all comments →