Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void shift(int n, int x[100])
- {
- int aux=x[0];
- for (int i=0; i<n; i++)
- x[i]=x[i+1];
- x[n-1]=aux;
- }
- int main()
- {
- int n, x[100];
- cin>>n;
- for(int i=0; i<n; i++)
- cin>>x[i];
- int nel=n;
- while(nel) {
- shift(nel, x);
- nel--;
- }
- for(int i=0; i<n; i++)
- cout<<x[i]<<" ";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement