Advertisement
Guest User

Untitled

a guest
Oct 21st, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. * Create a function called `calculateArea()` that takes one argument, the
  2. * diameter of a circle. The function should return the area of the circle,
  3. * with 4 decimals.
  4. *
  5. * Answer with the result if the diameter is 17. ( hint: `pi()` )
  6. *
  7. * Write your code below and put the answer into the variable ANSWER.
  8. */
  9.  
  10. function calculateArea($arg1)
  11. {
  12. $area = PI() * ($arg1 ** 2) / 4;
  13. $with4decimals = round($area, 4);
  14. return 'hint: ' . $with4decimals;
  15. }
  16.  
  17.  
  18. $ANSWER = calculatedArea(17);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement