Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Largest and smallest programming exercise 5 of 6
- 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:
- <?php
- $first = $_GET['first'];
- $second = $_GET['second'];
- $third = $_GET['third'];
- //Your code here
- $largest_number = largest($first, $second, $third);
- $smallest_number = smallest($first, $second, $third);
- echo "From the numbers you typed, the largest was $largest_number";
- echo " and smallest $smallest_number";
- ?>
- Example output
- From the numbers you typed, the largest was 10 and smallest -1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement