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 is the use of endl?
Must accepts "Maestro Cards" Tax for bike should be less than 15 Total number of lanes is more than 10 Must provides monthly pass Write a method: boolean isGoodTollBridge(String[] cardsAccepted, String[] tollTax, boolean hasMonthlyPass, int numberOfLanes); String[] cardsAccepted A String array of names of card types accepted for payment of toll tax, it can be null if the toll does not accept any card String[] tollTax A String array of toll tax chart (say “Train : 300â€Â,â€ÂBullCart : 10â€Â) boolean hasMonthlyPass This parameter defines whether there is any monthly pass available or not int numberOfLanes This parameter defines the number of lanes for each side
Write is a binary search tree? Write an algo and tell complexity?
How can you say that a template is better than a base class?
Explain the difference between overloading and overriding?
Is string data type in c++?
Is c++ still being used?
. If employee B is the boss of A and C is the boss of B and D is the boss of C and E is the boss of D. Then write a program using the Database such that if an employee name is Asked to Display it also display his bosses with his name. For eg. If C is displayed it should also display D and E with C?
Differentiate between a constructor and a method in C++.
What it is and how it might be called (2 methods).
Explain deep copy?
What is ostream in c++?
How do you declare a set in c++?
Can a program run without main function?
If a base class is an adt, and it has three pure virtual functions, how many of these functions must be overridden in its derived classes?