Math Functions I Codeacademy PHP Example

Math Functions I Codeacademy PHP Example

This is an easy one.

Here is a correct example for “Math Functions I” from the PHP course.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<html>
    <p>
    <?php
    // Try rounding a floating point number to an integer
    // and print it to the screen
    print round(14.5);
    ?>
    </p>
    <p>
    <?php
    // Try rounding a floating point number to 3 decimal places
    // and print it to the screen
    print round(14.5456897, 3);
    ?>
    </p>
</html>

Add a comment: