Advertisement
Blagovest

SumArrays

Jul 27th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace loops
  8. {
  9. class loops
  10. {
  11. static void Main(string[] args)
  12. {
  13. var arr1 = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
  14. var arr2 = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
  15.  
  16. var len = Math.Max(arr1.Length, arr2.Length);
  17.  
  18. var result = new int[len];
  19.  
  20. for (int i = 0; i < len; i++)
  21. {
  22. result[i]=arr1[i%arr1.Length]+arr2[i%arr2.Length];
  23. }
  24.  
  25. Console.WriteLine(string.Join(" ", result));
  26. }
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement