Saturday, 29 August 2015

ROUND,FLOOR,FIX,CEIL COMMANDS

Round:
 Rounds towards nearest integer
COMMANDS:
round(2.3) 
round(2.6)
the output is
  Screenshot (19)

the output of round(2.3) is 2 because the nearest integer for 2.3 is 2
 the output of round(2.6) is 3 because the nearest integer for 2.6 is 3
 Floor:
 it rounds towards negitive infinity code:

floor(2.7)
the output is

  Screenshot (20)

output is 2 because nearest integer in the direction of negitive infinity is 2

 ceil:
        it round towards positive infinity code:
ceil(2.3)
output is

  Screenshot (21)output is 3 because nearest integer in the direction of positive infinity is 3

 fix:
          rounds the number towards zero code:
fix(-1.3) 
fix(1.3)
the output is Screenshot (22) fix(-1.3) gives output -1 because nearest integer in  the direction of zero is -1
 fix(1.3) give s output 1 because nearest integer in the direction of zero is 1
 These are 4 commands to round numbers

No comments:

Post a Comment