Write a program to interchange two variables without using
the third variable?
Answer Posted / tom macdonald
#include<stdio.h>
void main()
{
int x,y;
printf("enter x and y: ");
scanf("%d%d",&x,&y);
x^=y;
y^=x;
x^=y;
printf("elements after swapping: %d,%d\n",x,y);
}
| Is This Answer Correct ? | 29 Yes | 32 No |
Post New Answer View All Answers
What is a spanning Tree?
What are different storage class specifiers in c?
while loop contains parts a) initialisation, evalution of an expression,increment /decrement b) initialisation, increment/decrement c) condition evalution d) none of the above
Are the variables argc and argv are local to main?
Explain how do you sort filenames in a directory?
What is the difference between array_name and &array_name?
What is string function in c?
What is file in c language?
Why isn't any of this standardized in c? Any real program has to do some of these things.
What is wrong in this statement? scanf(ā%dā,whatnumber);
What is meant by errors and debugging?
Explain how do you convert strings to numbers in c?
What is the argument of a function in c?
How do you use a 'Local Block'?
What is array of structure in c?