This program is to swap/exchange two numbers by using a variable.
For example:
Numbers to swap: 11 and 12
Let x= 11, y= 12
Swapping Logic:
t=x= 11
x =y =12
y =t =11
After swapping:
x= 12, y = 11
Algorithm
- STEP 1: START
- STEP 2: DEFINE x, y, t
- STEP 3: ENTER x, y
- STEP 4: PRINT x, y
- STEP 5: t = x
- STEP 6: x= y
- STEP 7: y= t
- STEP 8: PRINT x, y
- STEP 9: END
Java Program
Output:
C Program
Output:
Python Program
Output:
PHP Program
Output:
C# Program
Output: