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
The number of measuring units from an arbitarary starting point in a record,area,or control block to some other point a) recording pointer b) offset c) branching d) none
Differentiate fundamental data types and derived data types in C.
What is output redirection?
What are the types of unary operators?
What is the difference between near, far and huge pointers?
Can a variable be both static and volatile in c?
Do you know pointer in c?
How can you find the day of the week given the date?
What does c in a circle mean?
Explain the process of converting a Tree into a Binary Tree.
What is a sequential access file?
while initialization of array why we use a[][2] why not a[2][]...?
Can you write the algorithm for Queue?
What is the difference between a string and an array?
What are header files and what are its uses in C programming?