Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- namespace FoldAndSum
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[] num = Console.ReadLine().Split().Select(int.Parse).ToArray();
- int[] output = new int[num.Length / 2];
- for (int i = 0; i < output.Length; i++)
- {
- if (i < output.Length / 2)
- {
- output[i] = num[i + num.Length / 4] + num[num.Length / 4 - (1 + i)];
- }
- else
- {
- output[i] = num[i + num.Length / 4] + num[num.Length + (num.Length / 4) - (i + 1)];
- }
- }
- Console.WriteLine(string.Join(" ", output));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement