Friday, 24 January 2014

c program to swap two numbers

Q c program to swap two numbers 

swapping of two numbers in c

here is c example how to swap two numbers using third varibale
#include<stdio.h>
int main(){
int x,y, temp;
printf("Enter the value x and y\n");
swapping of two numbers in cscanf("%d%d",&x,&y);
printf("before swappingx=%d y=%d\n",x,y);
temp=x;
x=y;
y=x;
printf("after swapingx=%d y=%d\n",x,y);
return 0;
}

No comments:

Post a Comment