Write a program to swap two numbers using temporary variables and functions (call by value).
Runtime Input :
12
5
Output :
5
12
#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;
}
Comments
Leave a comment