Wednesday, September 17, 2008

C Programming on SWAPing of TWO VARIABLES WITHOUT USING of THIRD VARIABLE


void main()
{
  int a,b;
  clrscr();
  printf("\nEnter two numbers:");
  scanf("%d %d",&a,&b);
  printf("\nBefore swapping a=%d b=%d",a,b);
            a=a^b;
            b=b^a;
            a=a^b;
  printf("\nAfter swapping a=%d b=%d",a,b);
  getch();
}

No comments:

Post a Comment

Thanks to given comments.......

My Blog List