Advertisement
chefache

Untitled

May 31st, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3.  
  4. namespace Condense_Array_to_Number
  5. {
  6. class Program
  7. {
  8. static void Main(string[] args)
  9. {
  10. int[] nums = Console.ReadLine()
  11. .Split()
  12. .Select(int.Parse)
  13. .ToArray();
  14.  
  15. while (nums.Length > 0)
  16. {
  17. int[] condensed = new int [nums.Length - 1];
  18. for (int i = 0; i < nums.Length - 1; i++)
  19. {
  20. condensed[i] = nums[i] + nums[i + 1];
  21. }
  22. Console.WriteLine(condensed.Sum());
  23. break;
  24. }
  25.  
  26. }
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement