o_ignatov

04TrippleSum

Jun 8th, 2017
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace _04TrippleSum
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. long[] nums = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
  14. string message = String.Empty;
  15. for (int i = 0; i < nums.Length; i++)
  16. {
  17. for (int j = 1; j < nums.Length; j++)
  18. {
  19. if (i < j)
  20. {
  21. for (int k = 0; k < nums.Length; k++)
  22. {
  23. if (nums[i] + nums[j] == nums[k])
  24. {
  25. message = nums[i] + " " + "+" + " " + nums[j] + " " + "==" + " " + nums[k];
  26. Console.WriteLine(message);
  27. }
  28.  
  29. }
  30. }
  31. }
  32. }
  33. if (message.Length == 0)
  34. {
  35. Console.WriteLine("No");
  36. }
  37. }
  38. }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment