Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- namespace Triple_Sum
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[] arr = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
- int count = 0;
- for (int i = 0; i < arr.Length; i++)
- {
- for (int j = i + 1; j < arr.Length; j++)
- {
- int sum = arr[i] + arr[j];
- if (arr.Contains(sum))
- {
- Console.WriteLine("{0} + {1} == {2}", arr[i], arr[j], sum);
- count++;
- }
- }
- }
- if (count == 0)
- {
- Console.WriteLine("No");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement