Write a program that prompts the user to enter number in two variables and Swap the contents of the variables.
#include <stdio.h>
int main()
{
int num1, num2, temp;
printf("Enter first number :");
scanf("%d", &num1);
printf("Enter second number :");
scanf("%d", &num2);
temp = num1;
num1 = num2;
num2 = temp;
printf("After swapping, first is %d and second is %d.", num1, num2);
return 0;
}
Enter first number :10
Enter second number :15
After swapping, first is 15 and second is 10.