Advertisement
Guest User

Untitled

a guest
Feb 12th, 2019
1,409
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3.  
  4. namespace P08_MagicSum
  5. {
  6. class Program
  7. {
  8. static void Main(string[] args)
  9. {
  10. int[] input = Console.ReadLine()
  11. .Split()
  12. .Select(int.Parse)
  13. .ToArray();
  14.  
  15. int magicNum = int.Parse(Console.ReadLine());
  16.  
  17. for (int i = 0; i < input.Length - 1; i++)
  18. {
  19. for (int j = i + 1; j < input.Length; j++)
  20. {
  21. if (input[i] + input[j] == magicNum)
  22. {
  23. Console.WriteLine($"{input[i]} {input[j]}");
  24. }
  25. }
  26. }
  27. }
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement