Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- namespace _07._Sum_Arrays
- {
- class SumArrays
- {
- static void Main(string[] args)
- {
- int[] firstArr = Console.ReadLine()
- .Split().Select(int.Parse).ToArray();
- int[] secondArr = Console.ReadLine()
- .Split().Select(int.Parse).ToArray();
- int[] sumArr = new int[Math.Max(firstArr.Length, secondArr.Length)];
- for (int i = 0; i < sumArr.Length; i++)
- {
- sumArr[i] = firstArr[i % firstArr.Length] + secondArr[i % secondArr.Length];
- }
- foreach (var sum in sumArr)
- {
- Console.Write(string.Join(" ", $"{sum} "));
- }
- Console.WriteLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment