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
How can I pad a string to a known length?
What are the salient features of c languages?
How would you use the functions fseek(), freed(), fwrite() and ftell()?
Explain what is wrong with this program statement? Void = 10;
Describe dynamic data structure in c programming language?
Linked list is a Linear or non linear explain if linear how it working as a non linear data structures
How is a pointer variable declared?
What is file in c preprocessor?
Why is c still so popular?
Explain what is the stack?
I heard that you have to include stdio.h before calling printf. Why?
"C" language developed by "Dennis Ritchie" at AT & T. his remarks are a) too general, too abstract b) could deal with only specific problems c) lost generality of BCPL and B restored d) no remarks
Explain what is page thrashing?
Write a program to generate a pulse width frequency of your choise,which can be variable by using the digital port of your processor
i = 25;switch (i) {case 25: printf("The value is 25 ");case 30: printf("The value is 30 "); When the above statements are executed the output will be : a) The value is 25 b) The value is 30 c) The value is 25 The value is 30 d) none