# Field Manual for Hackers

## PHP - The marks obtained by student in five different subjects are input through the keyboard.the student get division or grade as per the following rule:

•     -60% or above   ----    first class
•     -50% to  59%  ------     second class
•     -40% to  49%  ------     third class
•     -Less than 40%   ------
Write a program to calculate the grades obtained by the student.

#### 6 comments:

1. ";

if(\$marks>=60)
{
echo "The Grade is First class grade";
echo "
";
}

elseif(\$marks>=50&&\$marks<=59)
{
echo "The Grade is Second class grade";
echo "
";
}

elseif(\$marks>=40&&\$marks<=49)
{
echo "The Grade is Third class grade";
echo "
";
}

elseif(\$marks<=40)
{
echo "The Grade is Fail ";
echo "
";
}

else
{
echo "Wrong input";
}
?>

2. This comment has been removed by the author.

3. This comment has been removed by the author.

4. php
\$num1=\$_POST['n1'];
\$num2=\$_POST['n2'];
\$num3=\$_POST['n3'];
\$num4=\$_POST['n4'];
\$num5=\$_POST['n5'];
\$avg= \$num1+\$num2+\$num3+\$num4+\$num5;
\$per= \$avg/5;
if(\$per>=60)
echo "grade is first class: A grade";
else if(\$per>=50&&\$per<59)
echo " grade is second class:B grade";
else if (\$per>=40&&\$per<49)
echo "grade is third class:C grade";
else if(\$per<40)
echo "grade is fourth class: fail";

5. \$marks1=\$_POST["n1"];
\$marks2=\$_POST["n2"];
\$marks3=\$_POST["n3"];
\$marks4=\$_POST["n4"];
\$marks5=\$_POST["n5"];
\$percentage=(\$marks1*\$marks2*\$marks3*\$marks4*\$marks5/5)*100;
if(\$percentage>=60)
echo "First class";
else if(\$percentage<60||\$percentage>=50)
echo "Second class";
else if(\$percentage<50||\$percentage>=40)
echo "Third class";
else if(\$percentage<40)
echo "Fail";
else
echo "Wrong input";

6. ?php
\$sub1=\$_POST["eng"];
\$sub2=\$_POST["hindi"];
\$sub3=\$_POST["science"];
\$sub4=\$_POST["sst"];
\$sub5=\$_POST["physics"];
\$total=\$sub1+\$sub2+\$sub3+\$sub4+\$sub5;
\$perc=\$total/5;
if(\$perc>=60)
{\$cls="first class";}
else
if(\$perc==50&&\$perc<=59)
{\$cls="second class";}
else
if(\$perc==40&&\$perc<49)
{\$cls="third class";}
else
if(\$perc<40)
{\$cls="fail";}
echo"class obtained is:"."\$cls";
?>