In this script I will initalize variables oneThird, oneQuarter
and threeQuarters
and show you how to round them and print them out with as many
decimal
places as you wish.
Here are the variables: 0.3333333333333333 and 0.25 and 0.75
Here they are rounded: 0 and 0 and 1
Here they are to one place 0.3 and 0.3 and 0.8
Here they are to two places 0.33 and 0.25 and 0.75
Here they are to three places 0.333 and 0.25 and 0.75
Notice that the trailing zeros have been dropped.