"tip = 15 / 100" is not allowed, but "tax = 6.?? / 100" is allowed. It's clear that the (more) general form one should use is to allow users to enter the tip as 15 and then convert it to a decimal in code.
No, but makes sense if you need a float type for division. Still inconvenient.
I don't understand that answer!
15 is the same as 15.0
why do I have to write it as 15.0
what's the difference?
what about the 100, why is it ok to write it as 100 and not a must to write it as 100.0 ?
I don't get it.
15 is an integer value while 15.0 is a float. If you do division only using two integers, you will get an integer back as a result. So if you did 6/10 you would get the result back as 1 given that is the closest integer value to the result.
Using the period denotes a float and any mult/div with one number being a float will return a floating point value. so 6.0/10 = 6.0/10.0 = 6/ 10.0 = 0.6
So while to us 6=6.0, they are two very different things in regard to coding.
Tip = 15 / 100 not allowed
yeah same thing here
tax did work but tip didnt