Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace FoldAndSum
- {
- class FoldAndSum
- {
- static void Main(string[] args)
- {
- int[] nums = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
- int[] leftPart = new int[nums.Length / 4];
- int[] midPart = new int[nums.Length / 2];
- int[] rightPart = new int[nums.Length / 4];
- var counter = 0;
- //left part folded
- while (counter < leftPart.Length)
- {
- leftPart[counter] = nums[counter];
- counter++;
- }
- counter = 0;
- //right part folded
- while (counter < rightPart.Length)
- {
- rightPart[counter] = nums[nums.Length-1-counter];
- counter++;
- }
- Console.WriteLine(string.Join(" ", leftPart));
- Console.WriteLine(string.Join(" ", rightPart));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement