Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- namespace _03_ZigZagArrays
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- string firstRow = "";
- string secondRow = "";
- string firstRowOutput = "";
- string secondRowOutput = "";
- for (int i = 1; i <= n; i++)
- {
- string[] array = Console.ReadLine().Split().ToArray();
- if (i % 2 != 0)
- {
- firstRow = array[0];
- secondRow = array[1];
- }
- else if(i % 2 == 0)
- {
- firstRow = array[1];
- secondRow = array[0];
- }
- firstRowOutput += firstRow + " ";
- secondRowOutput += secondRow + " ";
- }
- Console.WriteLine(firstRowOutput);
- Console.WriteLine(secondRowOutput);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement