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

Functions, Part I Forum

View Course » View Exercise

577 points
5154f64b41245bf2a4000012_962084104
Submitted by
Ajinkya Rane
over 4 years ago

What is the problem? I have been trying for so long...

<html>
<p>
<?php

$round = round(M_PI);
print $round;
?>

<?php
$rounddecimal = round(MPI, 3);
print $round_decimal;
?>


2 votes

permalink

$rounddecimal = round(MPI, 3);

Should be M_PI not MPI, hope this helps

404 points
Picture
Submitted by
Avsmak
over 4 years ago

2 Comments

5154f64b41245bf2a4000012_962084104 Ajinkya Rane over 4 years ago

it still says
Oops, try again! Your first call to round() should print an integer.

D0c56867482aff13d5a22b8efd699bb9?s=140&d=retro roun512 about 4 years ago

You wrote ( $rounddecimal but u printed $round_decimal Fix that ) Hope it help


-2 votes

permalink

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


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

930 points
D0c56867482aff13d5a22b8efd699bb9?s=140&d=retro
Submitted by
roun512
about 4 years ago

11 Comments

5154f64b41245bf2a4000012_962084104 Ajinkya Rane about 4 years ago

Thank You
!

D0c56867482aff13d5a22b8efd699bb9?s=140&d=retro roun512 about 4 years ago

Welcome anyTime

4fb90c6085cafa000301c847_798121046 CJ about 4 years ago

it doesn't work.

D0c56867482aff13d5a22b8efd699bb9?s=140&d=retro roun512 about 4 years ago

What did you write , please copy and paste it exactly yo make sure of the code

4fb90c6085cafa000301c847_798121046 CJ about 4 years ago

i just think its the browser....

D0c56867482aff13d5a22b8efd699bb9?s=140&d=retro roun512 about 4 years ago

ya maybe :)

52565eeb80ff337232001e7d_158831513 brennanpringle_4f151ba89c99ab0001018 about 4 years ago

You're missing the underscore in the constant "M_PI."

5154f64b41245bf2a4000012_962084104 Ajinkya Rane almost 4 years ago

Thanks for all the great help!

D0c56867482aff13d5a22b8efd699bb9?s=140&d=retro roun512 almost 4 years ago

@Brennan Pringle , about the underscore It's auto deleted in here because i didn't put my code in [code] tag :)

D0c56867482aff13d5a22b8efd699bb9?s=140&d=retro roun512 almost 4 years ago

@Ajinkya Rane , You are welcome , Glad that it helped you

D0c56867482aff13d5a22b8efd699bb9?s=140&d=retro roun512 almost 4 years ago

here is the right code

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


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