We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
"For eg: when you write (20/100) the quotient is 0" -- This is not correct, it returns 0 because you're using int and the Integer part of 0.20 is 0, if you used double it would work just fine. Mathematically, in this case, the order or the parentesis do not make a difference if you're using doubles: 12 * 20 /100 = 2.4 and 12 * (20/100) is also = 2.4.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Day 2: Operators
You are viewing a single comment's thread. Return to all comments →
I know this is old, but just for clarity...
"For eg: when you write (20/100) the quotient is 0" -- This is not correct, it returns 0 because you're using int and the Integer part of 0.20 is 0, if you used double it would work just fine. Mathematically, in this case, the order or the parentesis do not make a difference if you're using doubles: 12 * 20 /100 = 2.4 and 12 * (20/100) is also = 2.4.