Home | Computer Science

Write a programmer using if else

<html>
<body>
<?php
$a=1;
$b=2;
if($a>$b)
echo $a;
else
echo $b;
?>
     </html>
Output:-
2
 

Write a programme using if else

<html>
<body bgcolor="yellow">
<?php
$a=99;
$b=99;
$c=100;
$t=$a+$b+$c;
$per=($t/300)*100;
if($a>90 && $b>90 && $c>90){
    echo "<center><table border='2' bgcolor='red'><tr><th>";
    echo "Maths marks=";
    echo "</th><th>";
    echo $a;
    echo "</th></tr><tr><th>";
    echo "Science marks=";
    echo "</th><th>";
    echo $b;
    echo "</th></tr><tr><th>";
    echo "S.S.T marks=";
    echo "</th><th>";
    echo $c;
    echo "</th></tr><tr><th>";
    echo "Total=";
    echo "</th><th>";
    echo $t;
    echo "</th></tr><tr><th>";
    echo "Percentage=";
        echo "</th><th>";
echo $per;
echo "</th></tr></table>";
echo "Superb!";
echo "</center>";
}
else if($a<50 && $b<50 && $c<50){
    echo "<center><table border='2' bgcolor='red'><tr><th>";
    echo "Maths marks=";
    echo "</th><th>";
    echo $a;
    echo "</th></tr><tr><th>";
    echo "Science marks=";
    echo "</th><th>";
    echo $b;
    echo "</th></tr><tr><th>";
    echo "S.S.T marks=";
    echo "</th><th>";
    echo $c;
    echo "</th></tr><tr><th>";
    echo "Total=";
    echo "</th><th>";
    echo $t;
    echo "</th></tr><tr><th>";
    echo "Percentage=";
        echo "</th><th>";
echo $per;
echo "</th></tr></table>";
echo "Need improvement";
echo "</center>";
}
?>
</body>
</html>

output:-

"