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

When do we get logical errors?

1126


What is formal argument?

1137


What is putchar() function?

1163


What are pointers? What are stacks and queues?

1154


write a program in c language to print your bio-data on the screen by using functions.

6789


Should a function contain a return statement if it does not return a value?

1080


What is the difference between union and structure in c?

1178


Explain what is a 'null pointer assignment' error? Explain what are bus errors, memory faults, and core dumps?

1105


What are the different types of constants?

1077


How to draw the flowchart for structure programs?

9344


What are the different properties of variable number of arguments?

1164


How can I find the modification date and time of a file?

1085


Differentiate abs() function from fabs() function.

1018


Explain how can I right-justify a string?

1046


What does emoji p mean?

1120