Swap Two Numbers Without Third Variable

TCS NQT Coding Easy Go Ad-Free - ₹20/mo

Write a program to swap the values of two integers without using a third variable. The program should accept two integers as input and output their values after swapping.

Examples:

Input: 5 10

Output: 10 5

Input: -3 7

Output: 7 -3

Input: 0 0

Output: 0 0

Constraints

  • Input integers can be any valid 32-bit signed integer.
  • No specific range constraints mentioned, but assume standard integer limits.