Skip to content

Instantly share code, notes, and snippets.

@invatainfo
Last active April 7, 2018 11:39
#include <iostream>
using namespace std;
void shift(int n, int x[100]) {
int i, temp = x[0];
for (i = 1; i < n; i++)
x[i - 1] = x[i];
x[n - 1] = temp;
}
int main() {
int n, x[100];
cin >> n;
int i;
for (i = 0; i < n; i++)
cin >> x[i];
for (i = 0; i < n; i++)
shift(n - i, x);
for (i = 0; i < n; i++)
cout << x[i] << " ";
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment