This forum is now read-only. Please use our new forums at discuss.codecademy.com.

Functions, Part I Forum

View Course » View Exercise

142 points
2e26e0f10d430a999df978261e8075b8?s=140&d=retro
Submitted by
Justin Weissert
over 2 years ago

I need Help!!!!!!!!!!!!!!!!

<?php
// Try rounding a floating point number to an integer
// and print it to the screen
// Round pi down from 3.1416...
$round = round(MPI);
print $round; // prints 3
?>


<?php
// Try rounding a floating point number to 3 decimal places
// and print it to the screen
// This time, round pi to 4 places
$round
decimal = round(MPI, 3);
print $round
decimal; // prints 3.1416

?>
</p>

8 votes

permalink

<html>
    <p>
    <?php 
    $round = round(4.469);
    print $round; // prints4

    ?>
    </p>
    <p>
    <?php
    $round_decimal = round(M_PI, 3);
    print $round_decimal; // prints 3.1416
    ?>
    </p>
</html>

438 points
54777256631fe946230037c1_909508149
Submitted by
Alexander Hyldgaard
over 2 years ago

1 Comment

Fbaf234270436c72387d16c9d3aee862?s=140&d=retro Samantha Ma about 2 years ago

it worked!


0 votes

permalink

I think u forgot something in your code look closely..look at the example given.:)

445 points
23ef3c43ee51a22699804f9cb7a234a0?s=140&d=retro
Submitted by
Daniel Weber
over 2 years ago


0 votes

permalink

This works


<?php
// Try rounding a floating point number to an integer
// and print it to the screen
$round = round(MPI);
print $round;
?>


<?php
// Try rounding a floating point number to 3 decimal places
// and print it to the screen
$round
decimal = round(MPI, 3);
print $round
decimal;
?>

198 points
Aa77fee566042aeb379495e4c597dac4?s=140&d=retro
Submitted by
Evan Bridges
about 2 years ago