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 / tamal datta

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
printf("\n Enter a = ");
scanf("%d",&a);
printf("\n Enter b = ");
scanf ("%d",&b);
printf ("\nBefore swapping a = %d",a);
printf ("\nBefore swapping b = %d",b);
//swaping of 2 numbers without using temp variable
a=a+b;
b=a-b;
a=a-b;
printf("\nAfter swapping a = %d",a);
printf ("\nAfter swapping b= %d",b);
getch();
}

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are file streams?

978


hw can we delete an internal node of binary search tree the internal node has child node..plz write progarm

1984


What are the three constants used in c?

946


How can I handle floating-point exceptions gracefully?

1125


Can a void pointer point to a function?

982


An expression to whose value an operater is applied a) operand b) variable c) constant d) all of the above

1128


Why use int main instead of void main?

1080


Write a program to reverse a string.

1043


Explain the difference between structs and unions in c?

979


In c programming write a program that will print 10 multiples of 3 except 15,18,21 using looping

1442


Explain the use of keyword 'register' with respect to variables.

986


Why void main is used in c?

1018


Tell me what are bitwise shift operators?

1103


Write a program to implement queue.

1081


Explain built-in function?

1103