Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 decimal question
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
starlight




PostPosted: 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
Sponsor
sponsor
starlight




PostPosted: Sat Mar 05, 2005 11:48 am   Post subject: (No subject)

actually. it is fine now. I got it. Thanks anyway.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: