Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int[] array = Console.ReadLine()
- .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
- .Select(int.Parse)
- .ToArray();
- int magicNum = int.Parse(Console.ReadLine());
- for (int i = 0; i < array.Length - 1; i++)
- {
- int current = array[i];
- for (int j = i + 1; j < array.Length; j++)
- {
- int next = array[j];
- if(current + next == magicNum)
- {
- Console.WriteLine("{0} {1}", current, next);
- break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement