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 CondenseArrayToNumber
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[] nums = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
- while (nums.Length != 1)
- {
- for (int i = 0; i < nums.Length - 1; i++)
- {
- nums[i] = nums[i] + nums[i + 1];
- }
- Array.Resize( ref nums, nums.Length - 1);
- }
- Console.WriteLine(nums[0]);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement