[ create a new paste ] login | about

Link: http://codepad.org/GKnCsaKJ    [ raw code | output | fork ]

PHP, pasted on May 29:
1
2
3
4
5
6
7
8
9
10
11
<?php
    $score=array(80,90,90,99,78);
    
        $total=0;
        for ($a=0; $a< count($score); $a++) {
               $total+=$score[$a];
        }
        $avg = $total/count($score);
        echo ("score $score[0], $score[1], $score[2], $score[3], $score[4] <br>");
        echo ("total $total, average $avg <br>");
    ?>


Output:
1
score 80, 90, 90, 99, 78 <br>total 437, average 87.4 <br>


Create a new paste based on this one


Comments: