Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _04.ArrayRotation
- {
- class Program
- {
- static void Main(string[] args)
- {
- string[] inputArray = Console.ReadLine().Split();
- int rotations = int.Parse(Console.ReadLine());
- for (int i = 0; i < rotations; i++)
- {
- string firstElement = inputArray[0];
- for (int j = 0; j < inputArray.Length - 1; j++)
- {
- inputArray[j] = inputArray[j + 1];
- }
- inputArray[inputArray.Length - 1] = firstElement;
- }
- Console.WriteLine(string.Join(" ", inputArray));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement