Saturday, August 20, 2011

Swap or interchange two numbers without using variable.

//Program to swap or interchange two numbers without using variable.
#include<stdio.h>
#include<conio.h>
main()
{
 int a=10, b=20;
 clrscr();
 printf("\n Before interchange the value is: a=%d, b=%d",a,b);
 a=a+b;
 b=a-b;
 a=a-b;
 printf("\n After interchange the value is: a=%d, b=%d",a,b);
 getch();
}

Previous Next Home
0 Comments
Comments

Leave a Comment

:)) ;)) ;;) :D ;) :p :(( :) :( :X =(( :-o :-/ :-* :| 8-} :)] ~x( :-t b-( :-L x( =))

Twitter Delicious Facebook Favorites More