C Programs
Program for interchange their values with the help of the third Variable.
Write a C Program to input two numbers from the user and interchange their values with the help of the third Variable.
// C program to swap two variables
#include <stdio.h>
int main()
{
int x, y;
printf("Enter Value of x ");
scanf("%d", &x);
printf("\nEnter Value of y ");
scanf("%d", &y);
int temp = x;
x = y;
y = temp;
printf("\nAfter Swapping: x = %d, y = %d", x, y);
return 0;
}
Post a Comment
0 Comments