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 / gaurav sharma

#include<conio.h>
#include<stdio.h>
void main()
{
clrscr();
int a,b;
printf("enter the value of a : ");
scanf("%d",&a);
printf("enter the value of b : ");
scanf("%d",&b);
printf("Before swapping a is %d and b is %d",a,b);
a=a+b;
b=a-b;
a=a-b;
printf("\nAfter swapping of a and b:\na=%d\nb=%d",a,b);
getch();
}

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

in ‘C’ language for Matrix Multiplication fails” Introspect the causes for its failure and write down the possible reasons for its failure.

8040


What is f'n in math?

1065


What is the difference between volatile and const volatile?

983


What is LINKED LIST? How can you access the last element in a linked list?

1070


Tell us bitwise shift operators?

1091


Differentiate between a for loop and a while loop? What are it uses?

1171


What is the method to save data in stack data structure type?

1083


Explain what does a function declared as pascal do differently?

1278


which of the following statement is wrong a) mes=123.56; b) con='T'*'A'; c) this='T'*20; d) 3+a=b;

3251


How can I copy just a portion of a string?

1308


What is the use of a semicolon (;) at the end of every program statement?

1494


What are header files and what are its uses in C programming?

1228


write a c program for swapping two strings using pointer

2626


Can include files be nested?

1105


What does a pointer variable always consist of?

1093