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 TripleSum
- {
- class TripleSum
- {
- static void Main()
- {
- int[] numbers = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
- int count = 0;
- int sumOFAll = 0;
- for (int left = 0; left < numbers.Length; left++)
- {
- for (int right = left + 1; right < numbers.Length; right++)
- {
- sumOFAll = numbers[left] + numbers[right];
- if (numbers.Contains(sumOFAll))
- {
- Console.WriteLine("{0} + {1} == {2}",numbers[left],numbers[right],sumOFAll);
- count++;
- }
- }
- }
- if (count == 0)
- {
- Console.WriteLine("No");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment