Advertisement
Guest User

Untitled

a guest
Jul 29th, 2015
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. Largest and smallest programming exercise 5 of 6
  2.  
  3. The below PHP script prints the largest and smallest number given to a form. Your task is to write the missing functions (largest and smallest), that receive the integers given by user as parameters and then return the largest and smallest integers. Incomplete program:
  4.  
  5. <?php
  6.  
  7. $first = $_GET['first'];
  8.  
  9. $second = $_GET['second'];
  10.  
  11. $third = $_GET['third'];
  12.  
  13.  
  14.  
  15. //Your code here
  16.  
  17.  
  18. $largest_number = largest($first, $second, $third);
  19.  
  20. $smallest_number = smallest($first, $second, $third);
  21.  
  22.  
  23.  
  24. echo "From the numbers you typed, the largest was $largest_number";
  25.  
  26. echo " and smallest $smallest_number";
  27.  
  28.  
  29.  
  30. ?>
  31.  
  32.  
  33. Example output
  34.  
  35.  
  36. From the numbers you typed, the largest was 10 and smallest -1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement