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 interchange two variables without using
the third variable?

Answer Posted / tom macdonald

#include<stdio.h>
void main()
{
int x,y;
printf("enter x and y: ");
scanf("%d%d",&x,&y);
x^=y;
y^=x;
x^=y;
printf("elements after swapping: %d,%d\n",x,y);
}

Is This Answer Correct ?    29 Yes 32 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

regarding pointers concept

1980


Do you know the use of 'auto' keyword?

1129


Explain union. What are its advantages?

1008


how can f be used for both float and double arguments in printf? Are not they different types?

1014


Can include files be nested?

1059


What’s a signal? Explain what do I use signals for?

1054


Write a program on swapping (100, 50)

1063


Is null a keyword in c?

1139


What do you mean by dynamic memory allocation in c?

1050


In C language what is a 'dangling pointer'?

1063


Why we use int main and void main?

1017


How do we open a binary file in Read/Write mode in C?

1176


What is function definition in c?

1018


Can a function argument have default value?

1092


Why is event driven programming or procedural programming, better within specific scenario?

2366