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

#include<stdio.h>
main()
{
int a,b;
printf("enter the value of a and b\n");
scanf("%d%d",&a,&b);
printf("before swapping\na=%d\nb=%d\n",a,b);
a=a+b;
b=a-b;
a=a-b;
printf("after swapping\na=%d\nb=%d\n",a,b);
getch();
}

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is an operator?

1082


Can static variables be declared in a header file?

1066


Can a function argument have default value?

1161


a linearly ordered set of data elements that have the same structure and whose order is preserved in storage by using sequential allocation a) circular b) ordinary c) array d) linear list

1069


Are global variables static in c?

1176


why wipro wase

2317


Write a c program to build a heap method using Pointer to function and pointer to structure ?

4699


Explain what is the general form of a c program?

1099


What do you mean by dynamic memory allocation in c? What functions are used?

1169


Write a program to reverse a linked list in c.

1141


write a c program to calculate sum of digits till it reduces to a single digit using recursion

3318


What is a good data structure to use for storing lines of text?

1089


how could explain about job profile

1928


What are the different types of control structures in programming?

1136


Are the outer parentheses in return statements really optional?

1123