You are on page 1of 1

Aim :- Write a PHP program to save marks in array.

Display marks of individual subject along


with total and percentage.

<?php
$stud=array("English"=>75,"Hindi"=>81,"Marathi"=>76,"Maths"=>56,"Information Tech"=>80);
echo"<h2>Marks Of Student</h2>";
foreach($stud as $subject=>$marks)
{
echo"Student got $marks in $subject.<br>";
}
$total=0;
$total=$stud["English"]+$stud["Marathi"]+$stud["Hindi"]+$stud["Maths"]+$stud["Information Tech"];
echo"<hr>Total Marks of Student $total";
$percentage=$total/5;
echo"<hr>The percentage of Student :-$percentage";
?>

You might also like