View Code of Problem 79

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

Double click to view unformatted code.


Back to problem 79