Advertisement
Guest User

Untitled

a guest
May 30th, 2019
330
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3.  
  4. namespace ArraysExercisesZigZagArrays
  5. {
  6. class Program
  7. {
  8. static void Main(string[] args)
  9. {
  10. int num = int.Parse(Console.ReadLine());
  11. string[] arrayOne = new string[num];
  12. string[] arrayTwo = new string[num];
  13.  
  14. for (int i = 1; i <= num; i++)
  15. {
  16. string[] currArr = Console.ReadLine().Split().ToArray();
  17. if (i % 2 == 1)
  18. {
  19. arrayOne[i - 1] = currArr[0];
  20. arrayTwo[i - 1] = currArr[1];
  21. } else
  22. {
  23. arrayOne[i - 1] = currArr[1];
  24. arrayTwo[i - 1] = currArr[0];
  25. }
  26. }
  27. Console.WriteLine(string.Join(" ", arrayOne));
  28. Console.WriteLine(string.Join(" ", arrayTwo));
  29. }
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement