i writed double x = (17/100) * 888; return x . as a result 0.0 .
why even if only x = 17/100 , will be as result 0.0 ?
i already finished this task, but I am very interested in why this is so.

user 2710

Level 4

# why is 17/100 not 0.17? result 0.0?

Resolved

intcan not store/carry a decimal value. If you want to have a decimal result you need to convert one of the numbers to a decimal value so that the result carries a decimal. So all of these are acceptable:17.0/100 17/100.0 (double)17/100 17/(double100)