write a program to swap Two numbers without using temp variable.
Answer Posted / insane programmer
#include<stdio.h>
#include<conio.h>
void main()
{
int a=100, b=30;
clrscr();
a = a+b;
b = a-b;
a = a-b;
printf("Swapping without using third variable (using + and -).\n\n");
printf("Value of a=%d and b=%d.", a,b);
getch();
}
you can get more example here http://rajkishor09.hubpages.com/_eknow/hub/How-to-swap-two-numbers-without-using-third-temp-variable
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
When do we get logical errors?
What is formal argument?
What is putchar() function?
What are pointers? What are stacks and queues?
write a program in c language to print your bio-data on the screen by using functions.
Should a function contain a return statement if it does not return a value?
What is the difference between union and structure in c?
Explain what is a 'null pointer assignment' error? Explain what are bus errors, memory faults, and core dumps?
What are the different types of constants?
How to draw the flowchart for structure programs?
What are the different properties of variable number of arguments?
How can I find the modification date and time of a file?
Differentiate abs() function from fabs() function.
Explain how can I right-justify a string?
What does emoji p mean?