Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- namespace _04Problem_TripleSum
- {
- class TripleSum
- {
- static void Main(string[] args)
- {
- long[] numbers = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
- bool haveMatch = false;
- for (int leftDigit = 0; leftDigit < numbers.Length; leftDigit++)
- {
- for (int rightDigit = leftDigit + 1; rightDigit < numbers.Length; rightDigit++)
- {
- for (int sum = 0; sum < numbers.Length; sum++)
- {
- if (numbers[leftDigit] + numbers[rightDigit] == numbers[sum])
- {
- haveMatch = true;
- Console.WriteLine($"{numbers[leftDigit]} + {numbers[rightDigit]} == {numbers[sum]}");
- break;
- }
- }
- }
- }
- if (!haveMatch)
- {
- Console.WriteLine("No");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement