Division of a double returns zero
Author: Compaqster
Creation Date: 10/30/2010 8:30 AM
profile picture

Compaqster

#1
CODE:
Please log in to see this code.

This code prints 0 rather than 0.05. What am I doing wrong?
profile picture

Eugene

#2
Try this:
CODE:
Please log in to see this code.

In other words, there's ambiguity in how "5" should be treated - it can be an integer value, and in your case, integer division happens. Make sure the number is explicitly a double value by defining a double variable or casting the number.
profile picture

Cone

#3
CODE:
Please log in to see this code.
;)
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).