Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string[] myArr = Console.ReadLine()
- .Split(' ').ToArray();
- while (true)
- {
- string indexString = Console.ReadLine();
- if (indexString != "Print")
- {
- int index = int.Parse(indexString);
- for (int i = 0; i < index / 2; i++)
- {
- string temp = myArr[i];
- myArr[i] = myArr[index - 1 - i];
- myArr[index - 1 - i] = temp;
- }
- for (int i = 0; i < (myArr.Length - index) / 2; i++)
- {
- string temp = myArr[index + 1 + i];
- myArr[index + 1 + i] = myArr[myArr.Length - 1 - i];
- myArr[myArr.Length - 1 - i] = temp;
- }
- }
- else break;
- }
- Console.WriteLine(string.Join(" ", myArr));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement