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 to swap four numbers without using fifth variable?

Answer Posted / rocky

#include<stdio.h>
void main()
{
int a,b,c,d;
printf("enter values
");
scanf("%d %d %d %d",&a,&b,&c,&d);
printf("before swapping
");
printf("%d %d %d %d",a,b,c,d);
a=(a+d);
d=(a-d);
a=(a-d);
c=(c+b);
b=(c-b);
c=(c-b);
printf("after swapping:%d %d %d %d",a,b,c,d);
}

Is This Answer Correct ?    5 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Hi can anyone tell what is a start up code?

2085


What are pointers? Why are they used?

1186


What are the types of arrays in c?

1181


the maximum length of a character constant can be a) 1 character b) 8 characters c) 256 chaacters d) 125 characters

2302


What tq means in chat?

1127


Can a variable be both constant and volatile?

1127


What is structure packing in c?

1084


will u please send me the placement papers to my mail???????????????????

1840


Explain how can I convert a string to a number?

1104


Linked list is a Linear or non linear explain if linear how it working as a non linear data structures

2186


What is the difference between union and structure in c?

1183


Who developed c language?

1100


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

1109


What does printf does?

1254


How variables are declared in c?

1046