How to swap two values using a single variable ?

condition: Not to use Array and Pointer ?

Answer Posted / ankit anupam

well i think this was wht u were lookin for
#include<stdio.h>
int main()
{
int a, b;
printf("Enter two no");
scanf("%d%d",&a,&b);
printf("a=%d nd b=%d",a,b);
a=a+b;
b=a-b;
a=a-b;
printf("a=%d nd b=%d",a,b);
return 0;
}

Is This Answer Correct ?    16 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can my program discover the complete pathname to the executable from which it was invoked?

663


What is string function in c?

544


to print the salary of an employee according to follwing calculation: Allowances:HRA-20% of BASIC,DA-45% of BASIC,TA-10%. Deductions:EPF-8% of BASIC,LIC-Rs.200/-Prof.Tax:Rs.200/- create c language program?

1575


Draw a diagram showing how the operating system relates to users, application programs, and the computer hardware ?

2124


What are enums in c?

665






What are the types of type qualifiers in c?

652


What does s c mean in text?

619


What is void main () in c?

738


What is the difference between #include and #include 'file' ?

610


find the value of y y = 1.5x+3 for x<=2 y = 2x+5 for x>2

1533


What are pragmas and what are they good for?

580


a way in which a pointer stores the address of a pointer which stores the value of the target value a) reference b) allocation c) multiple indirection d) none

631


Is that possible to store 32768 in an int data type variable?

694


Explain a file operation in C with an example.

665


C program execution always begins with a) #include b) comment (/*-------*/) c) main() d) declaration instructions

615