I need help rounding the grade average from the grade calculator. For instance from like 25.5 to 26 and from 25.4 to 25. Also, I need help printing a letter grade from your average.
Here is what i have so far:
#!/usr/bin/perl
print "Content-type:text/html\n\n";
use CGI ':standard';
$grade1=param('grade1');
$grade2=param('grade2');
$grade3=param('grade3');
$grade4=param('grade4');
@array=($grade1,$grade2,$grade3,$grade4);
foreach $grade(@array) {
print "$grade <br> ";
if(($grade !=Null) || ($grade eq 0)) {$count++}
$total=$grade+$total;
}
$average=$total/$count;
print "Your total grade is $total <br>
Grades input: $count <br>
Your average grade is: $average";
Here is what i have so far:
#!/usr/bin/perl
print "Content-type:text/html\n\n";
use CGI ':standard';
$grade1=param('grade1');
$grade2=param('grade2');
$grade3=param('grade3');
$grade4=param('grade4');
@array=($grade1,$grade2,$grade3,$grade4);
foreach $grade(@array) {
print "$grade <br> ";
if(($grade !=Null) || ($grade eq 0)) {$count++}
$total=$grade+$total;
}
$average=$total/$count;
print "Your total grade is $total <br>
Grades input: $count <br>
Your average grade is: $average";