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

#include<stdio.h>
#include<conio.h>
void main()
{

int a=10,b=8;
a=a+b;//a=10+8=18
b=a-b;//b=18-8=10
a=a-b;//a=18-10=8
//hence a=8,b=10
}

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the types of arrays in c?

1184


how to create duplicate link list using C???

2564


What are the different types of linkage exist in c?

1035


Give the rules for variable declaration?

1187


What is a void * in c?

1083


What is pass by value in c?

1077


What is data structure in c language?

1120


What is enumerated data type in c?

1089


What are the different types of endless loops?

1083


Can we declare variables anywhere in c?

1008


What is the use of function in c?

1200


Can you please explain the difference between strcpy() and memcpy() function?

1081


I heard that you have to include stdio.h before calling printf. Why?

1078


Which of these functions is safer to use : fgets(), gets()? Why?

1118


Given only putchar (no sprintf, itoa, etc.) write a routine putlong that prints out an unsigned long in decimal. [ I gave the obvious solution of taking % 10 and / 10, which gives us the decimal value in reverse order. This requires an array since we need to print it out in the correct order. The interviewer wasn't too pleased and asked me to give a solution which didn't need the array ].

1101