-4

I'm building a sort of number balancer, but I am running into a problem where even in my console (2/3) evaluates to 0... which makes no sense. I'm fairly sure I'm working with floats, or integers, but why would it fail in the console? Anyways, any help is appreciated, I'm just trying write something to help me get the percentage of the total. (I.E. 2 of 3 is 66.6666%)

Spencer Cornwall
  • 289
  • 2
  • 14

1 Answers1

6

I'm fairly sure I'm working with floats

No, you work with integers, so the result is integer as well.

Make at least one number as a float, like:

2/3.0 or 2.0/3 in order to receive 0.66666.

M. Stavnycha
  • 433
  • 3
  • 9