koksibg

Sum_Arrays

Oct 5th, 2016
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.78 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 Sum_Arrays
  8. {
  9.     class Sum_Arrays
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int[] firstArray = Console.ReadLine().Split().Select(int.Parse).ToArray();
  14.             int[] secondArray = Console.ReadLine().Split().Select(int.Parse).ToArray();
  15.             int largegLength = Math.Max(firstArray.Length, secondArray.Length);
  16.             for (int i = 0; i < largegLength; i++)
  17.             {
  18.                 int firstValue = firstArray[i % firstArray.Length];
  19.                 int secondValue = secondArray[i % secondArray.Length];
  20.                 Console.Write("{0} ", firstValue + secondValue);
  21.             }
  22.         }
  23.     }
  24. }
Add Comment
Please, Sign In to add comment