Sign in to run tests against edge cases and save your code automatically.
Problem Description
Medium
Rotate Array Right
PRO1D & 2D Arrays
Array Rotation
MOD Indexing
Write a program that inputs 5 integers into an array, then inputs a whole number `k` (0 to 5). Rotate the array to the **right** by `k` positions, so that each value moves `k` places to the right and values that fall off the end wrap round to the start.
Output the rotated array, one value per line.
For example, rotating 1 2 3 4 5 right by 1 gives 5 1 2 3 4.
Example Input
1
2
3
4
5
1
Example Output
5
1
2
3
4
Success Rate:
0% (0 passed / 0 attempted)
Code
Draft auto-saved
Test Results
Click "Test Code" to evaluate your code against the tests.