Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace _01._Sum_Adjacent_Equal_Numbers
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- List<double> numbers = Console.ReadLine()
- .Split(" ", StringSplitOptions.RemoveEmptyEntries)
- .Select(double.Parse)
- .ToList();
- for (int i = 0; i < numbers.Count - 1; i++)
- {
- double currentIndex = numbers[i];
- double nextIndex = numbers[i + 1];
- if (currentIndex + nextIndex == numbers[i])
- {
- double result = numbers[i] + currentIndex + nextIndex;
- Console.WriteLine(result);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement