fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. // Find minimum element in rotated array
  6. cout<<"ENTER THE NUMBER,S OF ROTATION";
  7. int rot;
  8. cin>>rot;
  9. int arr[]={2,4,6,8,10};
  10. int size=5-1;
  11. int ans=arr[0];
  12. for(int i=0;i<rot;i++){
  13. int temp=arr[size];
  14. for(int j=size;j>0;j--){
  15.  
  16. arr[j]=arr[j-1];
  17. }
  18. arr[0]=ans;
  19. }
  20.  
  21. for(int i=0;i<=size;i++){
  22. cout<<arr[i]<<" ";
  23. }
  24. return 0;
  25. }
Success #stdin #stdout 0s 5320KB
stdin
1
stdout
ENTER THE NUMBER,S OF ROTATION2 2 4 6 8