GerexD

gy29_7,8

Mar 4th, 2017
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int a[50],x=0,n;
  8.  
  9. cout<<"N ";cin>>n;
  10. for(int i=1;i<=n;i++) cin>>a[i];
  11. for(int i=1;i<=n;i++) x=x+a[i];
  12.  
  13. for(int i=n;i>=1;i--) a[i+1]=a[i];
  14. a[1]=x;
  15. n++;
  16.  
  17. for(int i=1;i<=n;i++) cout<<a[i]<<" ";
  18. return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment