Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

write a program to swap Two numbers without using temp variable.

Answer Posted / insane programmer

#include<stdio.h>
#include<conio.h>

void main()
{
int a=100, b=30;
clrscr();

a = a+b;
b = a-b;
a = a-b;

printf("Swapping without using third variable (using + and -).\n\n");
printf("Value of a=%d and b=%d.", a,b);
getch();
}

you can get more example here http://rajkishor09.hubpages.com/_eknow/hub/How-to-swap-two-numbers-without-using-third-temp-variable

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can I read in an object file and jump to locations in it?

1026


How do you convert strings to numbers in C?

1218


What do you mean by command line argument?

1167


Can you please explain the difference between strcpy() and memcpy() function?

1065


pierrot's divisor program using c or c++ code

2236


How can I implement sets or arrays of bits?

1041


Explain data types & how many data types supported by c?

1082


What is the purpose of 'register' keyword?

1098


write a c program for swapping two strings using pointer

2624


What is the purpose of the statement: strcat (S2, S1)?

1165


Explain Function Pointer?

1160


What tq means in chat?

1120


Is there a built-in function in C that can be used for sorting data?

1250


Who developed c language?

1086


Not all reserved words are written in lowercase. TRUE or FALSE?

1229