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
c language supports bitwise operations, why a) 'c' language is system oriented b) 'c' language is problem oriented c) 'c' language is middle level language d) all the above
Tell me can the size of an array be declared at runtime?
Can a variable be both constant and volatile?
What is selection sort in c?
List the difference between a "copy constructor" and a "assignment operator"?
What are lookup tables in c?
What are the advantages of the functions?
Explain what are its uses in c programming?
Can math operations be performed on a void pointer?
What is indirection in c?
What is structure and union in c?
Tell me the use of bit field in c language?
What is the heap in c?
In c programming language, how many parameters can be passed to a function ?
What are examples of structures?