โ Back to Arrays
Question 426
Rotate Array Right by One
Rotate Array Right by One
The program reads an integern, then readsnintegers into an array. Rotate the array one position to the right (the last element moves to the front) and print the result on one line, space-separated with no trailing space. For the input5followed by1 2 3 4 5, print: 5 1 2 3 4 End the line with a newline.
Expected Output:
5 1 2 3 4
Topics:
Arrays
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท Ctrl+Space to expand shortcuts (cout, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.