View Code of Problem 79

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

Double click to view unformatted code.


Back to problem 79