Computer Science Canada

Rounding a number

Author:  faulkner16 [ Thu Feb 21, 2008 4:26 pm ]
Post subject:  Rounding a number

how can i round a result using turing?

Author:  HeavenAgain [ 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

Author:  faulkner16 [ 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

Author:  BigBear [ 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

Author:  faulkner16 [ Thu Feb 21, 2008 4:36 pm ]
Post subject:  RE:Rounding a number

thanks so much:)


: