SHARE
TWEET

23 1

peter8901 Feb 16th, 2020 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. void shift(int n,int x[101]){
  6.     int temp=x[0];
  7.     for(int i=0;i<n-1;i++)
  8.     {
  9.         x[i]=x[i+1];
  10.     }
  11.     x[n-1]=temp;
  12. }
  13. int main()
  14. {
  15.     int n;
  16.     int x[101];
  17.     cin>>n;
  18.     for(int i=0;i<n;i++)
  19.         cin>>x[i];
  20.     shift(n,x);
  21.     for(int i=0;i<n;i++)    cout<<x[i]<<" ";
  22.    
  23.     return 0;
  24. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top