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

Explain how can I open a file so that other programs can update it at the same time?

1065


What is the collection of communication lines and routers called?

1072


Explain 'bus error'?

1026


What is structure in c language?

1112


What does struct node * mean?

975


What is the difference between local variable and global variable in c?

1171


Are comments included during the compilation stage and placed in the EXE file as well?

1037


while initialization of array why we use a[][2] why not a[2][]...?

2312


write a programming in c to find the sum of all elements in an array through function.

2128


Explain about the constants which help in debugging?

1321


What is const keyword in c?

1128


Should a function contain a return statement if it does not return a value?

1031


Explain what is the stack?

1048


What is difference between stdio h and conio h?

1329


What is the difference between array and structure in c?

1097