Calculate Grade Of Student Using PHP

What we are going to see through this article is Calculate Grade Of Student Using PHP. Enter the scores of five subjects in the PHP program and calculate the total, average, and percentage.

There you will learn how to find the total, average, and percentage value of five subjects in the PHP language.

If marks are 60% or more, grade will be First Class.
If marks between 45% to 59%, grade will be Second Class.
If marks between 33% to 44%, grade will be Third Class.
If marks are less than 33%, student will be Fail.
Calculate Grade Of Student Using PHP

Calculate Grade of Student using PHP

<?php
$marks = 75;

if ($marks>=60)
{
	$grade = "First Class";
}
else if($marks>=45)
{
	$grade = "Second Class";
}
else if($marks>=33)
{
	$grade = "Third Class";
}
else
{
	$grade = "Fail";
}

echo "Student grade: $grade";
?>

Read Also: Check Given Number Is Disarium Number In PHP

Output

Student grade : First Class

Conclusion

What we learned through this article is to Calculate the Grade Of Student Using PHP. Also if you have any doubts please leave a comment via the comment box. And we ask that you benefit everyone who shared this article with your friends.

Leave a Comment