Search This Blog

Wednesday, February 9, 2011

to interchange two values

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c;
printf("enter value for A and B=");
scanf("%d%d",&a,&b);
/*real logic starts from here*/
c=b;
b=a;
a=c;
printf("now a is=%d\nand b is=%d",a,b);
getch();
}

output:
enter value for A and B=10 12
now a is=12
and b is=10

No comments:

Post a Comment