al__nasim

DS LAB FINAL PROBLEM 1

Aug 8th, 2016
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.  
  7. int A[100],i,j,n,r,t;
  8. cin>>n>>r;
  9. for(i=0; i<n; i++)
  10. {
  11. cin>>A[i];
  12. }
  13. for(j=0; j<r; j++){
  14.  
  15. t=A[0];
  16.  
  17. for(i=1; i<n; i++)
  18. {
  19. A[i-1]=A[i];
  20. }
  21. A[n-1]=t;
  22.  
  23. }
  24. for(i=0;i<n;i++){
  25. cout<<A[i] << " ";
  26. }
  27.  
  28. return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment