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 / sneha

two ways to swap a number....
1st method
main()
{
int a,b;
printf("enter two numbers for swaping");
scanf("%d%d",&a,&b);
a=a+b;
b=a-b;
a=a-b;
printf("a=%d,b=%d",a,b)
getch()
}

2nd method
main()
{
int a,b;
printf("enter two numbers for swaping");
scanf("%d%d",&a,&b);
a=a*b;
b=a/b;
a=a/b;
printf("a=%d,b=%d",a,b)
getch()
}

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

#include { printf("Hello"); } how compile time affects when we add additional header file .

1868


For what purpose null pointer used?

1031


Can math operations be performed on a void pointer?

1015


Linked lists -- can you tell me how to check whether a linked list is circular?

1050


When should a far pointer be used?

1088


What is far pointer in c?

1255


What are the disadvantages of external storage class?

1024


write a c program to print the next of a particular no without using the arithmetic operator or looping statements?

3885


Which is not valid in C a) class aClass{public:int x;}; b) /* A comment */ c) char x=12;

1041


What does c value mean?

1139


What is the use of getch ()?

1052


How can you increase the size of a statically allocated array?

1055


I need a help with a program: Write a C program that uses data input in determining the whole of points A and a whole of circles B. Find two points in A so that the line which passes through them, cut through the maximum number of circles.

1912


An application package has been provided to you without any documents for the following application. The application needs to be tested. How will you proceed?

1199


What is conio h in c?

1013