Advertisement
AnastasiyaG

Untitled

Jan 30th, 2020
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3.  
  4. namespace Lab_7
  5. {
  6. class Program
  7. {
  8. static void Main(string[] args)
  9. {
  10.  
  11. int[] arr1 = Console.ReadLine()
  12. .Split()
  13. .Select(int.Parse)
  14. .ToArray();
  15.  
  16. int[] condensed = new int[arr1.Length - 1];
  17. while (true)
  18. {
  19. for (int i = 0; i < condensed.Length - 1; i++)
  20. {
  21. condensed[i] = arr1[i] + arr1[i + 1];
  22.  
  23.  
  24. }
  25. arr1 = condensed;
  26. if (arr1.Length == 1)
  27. { Console.WriteLine(arr1[0]);
  28.  
  29. break;
  30. }
  31.  
  32.  
  33. }
  34.  
  35. }
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement