write a program to swap Two numbers without using temp variable.
Answer Posted / ratna
#include<stdio.h>
main()
{
int x,y;
printf("\n enter the two numbers:\n");
scanf("%d%d",&x,&y);
y=(x+y)-y;
x=(x+y)-x;
printf("\n x=%d \n y=%d\n");
getch();
}
output: enter the two numbers:10
20
execute the conditions y=30-20=10
x=30-10=20
finally display the output:20 10
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
If you know then define #pragma?
What are called c variables?
What's a good way to check for "close enough" floating-point equality?
What is this pointer in c plus plus?
Define circular linked list.
can we implement multi-threads in c.
How can I do graphics in c?
What does 2n 4c mean?
When I set a float variable to, say, 3.1, why is printf printing it as 3.0999999?
How can you increase the allowable number of simultaneously open files?
What are multibyte characters?
What is the difference between union and anonymous union?
What are inbuilt functions in c?
What is the value of h?
What are identifiers c?