Posted: Sat Mar 05, 2005 11:33 am Post subject: decimal question
Hw can you write a programe using loop which prints the decimal equivalent of the fractions 1/2 to 1/10?
sample output
the decimal equivalent of 1/2 is .500
....
the decimal equivalent of 1/10 is .100
I tried to write this, but it doesn't work.
code:
var decimal : real
var denominator :real:=1
loop
decimal:= 1 /(denominator + 1)
put "The decimal equivalent of", decimal : 3, "is", decimal : 3
exit when denominator >= 10
end loop
Thanks in advance
Sponsor Sponsor
starlight
Posted: Sat Mar 05, 2005 11:48 am Post subject: (No subject)
actually. it is fine now. I got it. Thanks anyway.