Swap Two Numbers Problem Statement

Given two integers a and b, your task is to swap these numbers and output the swapped values.

Input:

The first line contains a single integer 't', representing the number of test cases.
Each subsequent line contains two space-separated integers, 'a' and 'b'.

Output:

For each test case, output the swapped values in a single line as 'b' followed by 'a'.

Example:

Input:
2
3 4
5 6
Output:
4 3
6 5

Constraints:

  • 1 <= 't' <= 102
  • -105 <= 'a', 'b' <= 105
  • Time Limit: 1 sec

Note:

You do not need to print anything; it has already been taken care of. Just implement the specified function to return the results.

Be the first one to answer
Add answer anonymously...
Ernst & Young Associate Software Engineer Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter