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 variables a=5 , b= 10 without
using third variable

Answer Posted / nagendra kumar

#include<stdio.h>
main(){
int a,b;

printf("Enter A value: ");
scanf("%d",&a);

printf("\nEnter B value: ");
scanf("%d",&b);


printf("\nThe value of A is:%d",a);
printf("\n The value of B is:%d",b);

a=a+b;
b=a-b;
a=a-b;

printf("\n The value of A is:%d",a);
printf("\n The value of B is:%d",b);
}

Is This Answer Correct ?    20 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Do you know pointer in c?

1041


Why c is called top down?

1151


Explain what happens if you free a pointer twice?

1074


How to declare pointer variables?

1231


Is javascript based on c?

1059


What does main () mean in c?

1095


What is the use of extern in c?

1092


What is the package for freshers(Non IIT) in amazon(hyderabad). And what is the same for those who are a contract employee.

4281


Write a program to check prime number in c programming?

1084


Is it better to bitshift a value than to multiply by 2?

1090


How are 16- and 32-bit numbers stored?

1282


What is clrscr in c?

1130


Explain the properties of union. What is the size of a union variable

1184


Can we change the value of #define in c?

996


main() { inta=10,b=20; a>=5?b=100:b=200; printf("%d ",b); }

1543