C Program to Swap Two Numbers Without Using Third(Temporary) Variable
In this program we will swap two numbers without using a third variable.
- //C Program to swap two numbers without using third(temporary) variable
-
- #include<stdio.h>
-
- int main()
- {
- int a, b;
- printf("Enter first number: ");
- scanf("%d", &a);
-
- printf("Enter second number: ");
- scanf("%d", &b);
-
- a = a + b;
- b = a - b;
- a = a - b;
-
- printf("Swapping of the numbers are= %d, %d", a, b);
- return 0;
- }
Output

Solution not working or have any suggestions? Please send an email to [email protected]
Download Android App