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 _08.Condense_Array_to_Number
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[] arr = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
- while(arr.Length>1)
- {
- int[] condensed = new int[arr.Length - 1];
- for (int i = 0; i < arr.Length; i++)
- {
- if (i == arr.Length-1)
- {
- break;
- }
- condensed[i] = arr[i] + arr[i + 1];
- }
- arr = condensed;
- }
- Console.WriteLine(string.Join("", arr).ToArray());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement