You are viewing a single comment's thread. Return to all comments →
when i write tempAnswer = tempAnswer + (Math.pow(2,j)*b); it gives an error of loss of precision. Can you please explain me why is it so?
pow() gives a double value,but you are using an integer so the precision is lost..Type cast the pow() function to integer .
You will get it done.
In case you haven't noticed, first you need to take all the inputs and then output according to each of them. Not, give the output after every, input.