Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Diagnostics.CodeAnalysis;
- using System.Linq;
- using System.Numerics;
- using System.Threading;
- namespace SoftuniExercisesWithVariables
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine("Enter your array here: ");
- int[] array = Console.ReadLine().Split(" ").Select(int.Parse).ToArray();
- int[] array1 = new int[array.Length/2];
- int[] array2 = new int[array.Length / 2];
- int count2 = 0;
- int count = 0;
- for(int i = array.Length / 4-1; i >= 0; i--)
- {
- array1[count] = array[i];
- count++;
- count2++;
- }
- int count1 = 0;
- for(int k = array.Length / 4; k < array.Length/4+ array.Length / 2; k++)
- {
- array2[count1] = array[k];
- count1++;
- }
- for(int l = array.Length-1; l >= array.Length / 4 + array.Length / 2; l--)
- {
- array1[count2] = array[l];
- count2++;
- }
- foreach(int k in array1)
- {
- Console.Write(k + " ");
- }
- Console.WriteLine();
- foreach (int s in array2)
- {
- Console.Write(s + " ");
- }
- int[] summedArray = new int[array1.Length];
- for(int j = 0; j < summedArray.Length; j++)
- {
- summedArray[j] = array1[j] + array2[j];
- }
- Console.WriteLine();
- foreach (int h in summedArray)
- {
- Console.Write(h + " ");
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment