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...

How many ways are there to swap two numbers without using
temporary variable? Give the each logic.

Answer Posted / gana samantula

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
clrscr();
printf(" Enter the first No.:");
scanf("%d",&a);
printf(" Enter the second No.:");
scanf("%d",&b);
b=a+b-(a=b);
printf(" the swap of a and b numbers :%d %d",a,b);

getch();
}

Is This Answer Correct ?    14 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the best way to store flag values in a program?

1082


What is the most efficient way to count the number of bits which are set in an integer?

1067


What are register variables? What are the advantage of using register variables?

1191


what is different between auto and local static? why should we use local static?

1128


How macro execution is faster than function ?

1200


How do you search data in a data file using random access method?

1308


Is it possible to pass an entire structure to functions?

998


how do you programme Carrier Sense Multiple Access

1969


When should you use a type cast?

1129


how to write a c program to print list of fruits in alpabetical order?

2306


What are variables and it what way is it different from constants?

1245


What is putchar() function?

1167


What is the meaning of typedef struct in c?

1072


How will you declare an array of three function pointers where each function receives two ints and returns a float?

1377


What do you mean by a local block?

1087