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);

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

Is This Answer Correct ?    4 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why is main function so important?

1083


Can the size of an array be declared at runtime?

1065


How can I implement sets or arrays of bits?

1026


How the c program is executed?

1137


Difference between strcpy() and memcpy() function?

1112


The __________ attribute is used to announce variables based on definitions of columns in a table?

1183


Explain how can you tell whether a program was compiled using c versus c++?

1085


Explain the Difference between the New and Malloc keyword.

1118


Differentiate between a structure and a union.

1270


what is the function of pragma directive in c?

1104


Suggesting that there can be 62 seconds in a minute?

1030


Is c is a procedural language?

1071


What is const and volatile in c?

1032


Describe the header file and its usage in c programming?

1046


What is difference between union and structure in c?

1135