Advertisement
PIBogdanov

C#

Jan 27th, 2023
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.54 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3.  
  4. namespace _08.CondenseArrayToNumber
  5. {
  6.     internal class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             int[] numbers = Console.ReadLine().Split().Select(int.Parse).ToArray();
  11.  
  12.             for (int i = 0; i < numbers.Length - 1; i++)
  13.             {
  14.                 for (int j = 0; j < numbers.Length - 1; j++)
  15.                 {
  16.                     numbers[j] += numbers[j + 1];
  17.                 }
  18.             }
  19.  
  20.             Console.WriteLine(numbers[0]);
  21.         }
  22.     }
  23. }
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement