write a program in C to swap two variables
Answer Posted / muzammil
Here are some LOGICS to swap two nmbrs
1) a+=b; b=a-b; a-=b;
2) a*=b; b=a/b; a/=b;
3) a=a^b; b=a^b; a=a^b;
Now Single line statements
4) a=a-(b=(-b+(a=a+b)));
5) a=a^(b=(b^(a=a^b)));
6) b=a+b-(a=b); This one was posted BY Senthil Thanks to him
7) b=a*b/(a=b); Dis is same as above one except for da
operators.
Is This Answer Correct ? | 5 Yes | 0 No |
Post New Answer View All Answers
How do I round numbers?
Explain void pointer?
What is an endless loop?
What is clrscr ()?
i have to apply for rbi before that i need to know the the syllabus for the entrance questions. whethet it may be aps or techinical
Is it possible to have a function as a parameter in another function?
What is nested structure with example?
When should the register modifier be used? Does it really help?
What is ambagious result in C? explain with an example.
Can you please compare array with pointer?
What is string function c?
How can I remove the trailing spaces from a string?
What is the difference between the local variable and global variable in c?
‘SAVEPOINT’ and ‘ROLLBACK’ is used in oracle database to secure the data comment. Give suitable examples of each with sql command.
What is storage class?