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

Username:   Password: 
 RegisterRegister   
 Rounding a number
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
faulkner16




PostPosted: Thu Feb 21, 2008 4:26 pm   Post subject: Rounding a number

how can i round a result using turing?
Sponsor
Sponsor
Sponsor
sponsor
HeavenAgain




PostPosted: Thu Feb 21, 2008 4:30 pm   Post subject: RE:Rounding a number

there are about 3 rounding
code:

floor (1.9) % gives you 1
ceil (1.1) % gives you 2
round(1.5) % gives you 2
faulkner16




PostPosted: Thu Feb 21, 2008 4:33 pm   Post subject: Re: Rounding a number

ok im just learning hte basics right now, so where would i put the word" round" then

i have my "

average:= (A+B+C+D)\4

and i want the outcome rounded
BigBear




PostPosted: Thu Feb 21, 2008 4:34 pm   Post subject: Re: Rounding a number

So if you do some thing like [code] var number :real
put "Enter a number: "..
get number
put number, " rounded is ", round(number) % or ceil if u want highest whole number or floor if you want smallest interger
%decimal number can only be entered if number is a real not an int
faulkner16




PostPosted: Thu Feb 21, 2008 4:36 pm   Post subject: RE:Rounding a number

thanks so much:)
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  [ 5 Posts ]
Jump to:   


Style:  
Search: