Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int[] sourceArray = Console.ReadLine().Split().Select(int.Parse).ToArray();
- int[] destinationArray = Console.ReadLine().Split().Select(int.Parse).ToArray();
- int sourceStartIndex = int.Parse(Console.ReadLine());
- int destStartIndex = int.Parse(Console.ReadLine());
- int count = int.Parse(Console.ReadLine());
- if (sourceStartIndex >= 0 && sourceStartIndex < sourceArray.Length && destStartIndex + count >= 0 && destStartIndex + count < destinationArray.Length)
- {
- int endIndex = sourceStartIndex + count;
- for (int i = sourceStartIndex; i <= endIndex; i++)
- {
- destinationArray[destStartIndex] = sourceArray[i];
- destStartIndex++;
- }
- }
- else
- {
- Console.WriteLine("Throw index out of range exception");
- return;
- }
- Console.WriteLine(String.Join(" ", destinationArray));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement