How to swap values between two variables without using a
third variable?
Answer Posted / banti sharma
Miss Sobha upto My Knowlegde the answer of "Shiv" was most
appropriate and if you have Any knowledge of Programming I
repeat again "Any knowledge of programming" then you may
find it out yourself that Bitwise Shift Operation is much
more time Efficient then that of "+","-","*","/.And if I say
about my answer then it is also correct having No mistakes
as the Question is "How to swap values between two variables
without using a third variable?" so if you read it carefully
then it does not say anywhere to print the Swaped values.I
think you have got Y i wrote like that,IF I say about
another logic then one more logic may be used like:
a=a*b;
b=a/b;
a=a/b;
though I m using Multiply and Devision still its better then
my past logic(so better then urs aytomatically) now if You
may find y? multiplication/Devision is more efficient then
Plus/minus then Do Googling.
have a good day
| Is This Answer Correct ? | 7 Yes | 12 No |
Post New Answer View All Answers
Hi guyes, I have cleared 2 technical rounds with cts for liferay and java techonologies, i have client round next week, please tell me how to prepare for this what questions i should be ready to face?
difference between mantis and other tools?
What is the use of sas software? Is sas and sap are different?
THE CHANNEL IN DATA COMMUNICATION CAN BE?
What is SOLID Principle in Programming Language?
When you deliver your C++ headers and C++ library of a class (what all can you change in the class so that application using your class does not need to recompile the code)
I am taking the bmc control m/enterprise manager 7.0 scheduling test and just wanted to see what kind of questions they would ask or if anyone has taken the test and how long it is for how many questions?
Write a pascal program to calculate the sum of the first 100 even number and odd number
when a query is made on Logical file in DB2/400, will the records satisfying select/omit criterion be fetched from all members of physical file or only the member with same name as physical file?
why we need to take u?
Given an array of size n, containing every element from 1 to n+1, except one. Find the missing element.
How to set fixed width in particular
what is best way to create a Thread class & why?
what is diff bet ref variable & instance of class
what are stubs related to foxpro?