Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title>Mean Result</title>
- </head>
- <body>
- <?php
- if(isset($_POST['numbers'])){
- $input=$_POST['numbers'];
- $array = explode(",", $input);
- $sum = 0;
- $count = count($array);
- for ($i = 0; $i < $count; $i++) {
- $sum += $array[$i];
- }
- $mean = $sum / $count;
- echo "The Mean is: " . $mean;
- } else {
- echo "No input received.";
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement