how to swap two integers 1 and 32767 without using third
variable
Answer Posted / sharath kumar
As int max valur is 32767. If we increment it it becomes -32768, so its a wrong way to do
a=1; b=32767;
a=-a; b=-b;
a=a+b; //-32768 with in range
b=a-b; //-1
a=a-b; //-32767
printf("%d%d",-a,-b);
| Is This Answer Correct ? | 4 Yes | 0 No |
Post New Answer View All Answers
we need to calculating INCOME TAX for the person. The INCOME TAX is as follows:- First $10000/- of income : 4% tax Next $10000/- of income : 8% tax Next $10000/- of income : 11.5% tax above $10, 00,00/- : 15% tax What is the Solution of this Question ?
What are the parts of c program?
Why doesnt long int work?
What is #ifdef ? What is its application?
What are file streams?
Explain the difference between structs and unions in c?
What is a double c?
Can you assign a different address to an array tag?
Why do we use pointer to pointer in c?
How can I get random integers in a certain range?
What is function prototype?
Hai what is the different types of versions and their differences
Is null a keyword in c?
while initialization of array why we use a[][2] why not a[2][]...?
What is #error and use of it?