#include int main() { int array[10]={1,2,3,4,5,6,7,8,9,10},i=0,ch=0,temp=0,temp1=0,k=0; //printf("check: %d\n", (1-3)%10); printf("Enter value of K:"); scanf("%d",&k); temp=array[0]; while(1) { int index = (i-k)%10; if(index < 0) index = (index + 10)%10; temp1 = array[index]; array[index] = temp; i = index; temp=temp1; if( i == 0) break; } for(ch = 0;ch<10;ch++) { printf("%d\t",array[ch]); } printf("\n"); return 0; }