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
What is the difference between text and binary i/o?
Difference between pass by reference and pass by value?
What is spaghetti programming?
What are the advantages of the functions?
Why c language?
Device an algorithm for weiler-atherton polygon clipping, where the clipping window can be any specified polygon
Is it possible to use curly brackets ({}) to enclose single line code in c program?
Why doesnt the call scanf work?
What is 2c dna?
#include main() { enum _tag{ left=10, right, front=100, back}; printf("left is %d, right is %d, front is %d, back is %d",left,right,front,back); }
Can a variable be both const and volatile?
Why c is called free form language?
Are the expressions * ptr ++ and ++ * ptr same?
What is a buffer in c?
what is a function method?give example?