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

Explain high-order and low-order bytes.

1047


Is c is a high level language?

1124


What are data structures in c and how to use them?

1093


Why is c fast?

1007


What is the difference between array_name and &array_name?

1237


show how link list can be used to repersent the following polynomial i) 5x+2

2190


What is local and global variable in c?

1127


what is the height of tree if leaf node is at level 3. please explain

2086


What does printf does?

1190


How can I run c program?

1123


Explain what is page thrashing?

1052


Can we replace the struct function in tree syntax with a union?

1236


the real constant in c can be expressed in which of the following forms a) fractional form only b) exponential form only c) ascii form only d) both a and b

2613


What is hungarian notation? Is it worthwhile?

1167


Explain why can’t constant values be used to define an array’s initial size?

1303