C Program to Swap Two Numbers
To swap two numbers we will use another temporary variable to store the value of first number.
- //C Program to swap two numbers"
-
- #include<stdio.h>
-
- int main()
- {
- int a, b, c;
- printf("Enter first number: ");
- scanf("%d", &a);
-
- printf("Enter second number: ");
- scanf("%d", &b);
-
- c=a;
- a=b;
- b=c;
-
- printf("Swapping of the numbers are= %d, %d", a, b);
- return 0;
- }
Output
