PDA

View Full Version : cgi code division (/) resulting in decimal instead of whole number


helpmeok
03-20-2008, 03:37 PM
When I add (+), subtract (-), and multiply (*) in cgi code the answer is in a whole number, but when I divide (/), I get a decimal.

How can I get a whole number instead of a decimal?
When I divide 20 by 4 the result is .2

FishMonger
03-20-2008, 04:24 PM
When I add (+), subtract (-), and multiply (*) in cgi code the answer is in a whole number, but when I divide (/), I get a decimal.

How can I get a whole number instead of a decimal?perldoc -f int
perldoc -f sprintf
perldoc -f printf

When I divide 20 by 4 the result is .2No it isn't, you have it backwards. The result of 4 divided by 20 is .2