how to swap two numbers with out using temp variable
Answer Posted / vishal gupta
well, use math:
x=5;
y=7;
x = x * y;
y = x / y;
x = x / y;
And the numbers have been swapped without the use of an
extra variable. I hope it helped.
| Is This Answer Correct ? | 44 Yes | 8 No |
Post New Answer View All Answers
What number of digits that can be accuratly stored in a float (based on the IEEE Standard 754)? a) 6 b) 38 c) An unlimited number
What are arrays c++?
What is this weird colon-member (" : ") syntax in the constructor?
What do you mean by ‘void’ return type?
What is copy constructor? Can we make copy constructor private in c++?
What is the need of a destructor?
Explain the difference between c & c++?
Eplain extern keyword?
Which bitwise operator is used to check whether a particular bit is on or off?
What is the type of 'this' pointer?
What is the best free c++ compiler for windows?
What is abstraction in c++?
What are the classes in c++?
Explain the difference between new() and malloc() in c++?
What c++ library is string in?