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;
- namespace SoftuniExercisesWithVariables
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine("Enter the numbers in your array: ");
- int[] array1 = Console.ReadLine().Split(" ").Select(int.Parse).ToArray();
- int length = array1.Length;
- int[] condensed = new int[length-1];
- while(length > 1)
- {
- condensed = new int[length-1];
- for(int i = 0; i < condensed.Length; i++)
- {
- condensed[i] = array1[i] + array1[i + 1];
- }
- for(int m = 0; m < condensed.Length; m++)
- {
- array1[m] = condensed[m];
- }
- length--;
- }
- Console.WriteLine(condensed[0]);
- }
- }
- }
Add Comment
Please, Sign In to add comment