-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
66 lines (59 loc) · 1.95 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<!--code that will take 5 input marks fromt the user and display the avarayge and also show the percentage of the marks-->
<!--and assign grade-->
<!--Conditions:-->
<!--✓ If marks are 60% or more, grade will be First Division.-->
<!--✓ If marks between 45% to 59%, grade will be Second Division.-->
<!--✓ If marks between 33% to 44%, grade will be Third Division.-->
<!--✓ If marks are less than 33%, student will be Fail.-->
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Assign Grade</title>
</head>
<body>
<form action="que1.php" method="POST">
<input type="number" name="num1" placeholder="Enter first number">
<br>
<input type="number" name="num2" placeholder="Enter second number">
<br>
<input type="number" name="num3" placeholder="Enter third number">
<br>
<input type="number" name="num4" placeholder="Enter fourth number">
<br>
<input type="number" name="num5" placeholder="Enter fifth number">
<br>
<input type="submit" name="submit" value="Add">
</form>
</body>
</html>
<?php
if(isset($_POST['submit'])){
$num1 = $_POST['num1'];
$num2 = $_POST['num2'];
$num3 = $_POST['num3'];
$num4 = $_POST['num4'];
$num5 = $_POST['num5'];
$sum = $num1 + $num2 + $num3 + $num4 + $num5;
$avg = $sum / 5;
$percentage = ($sum / 500) * 100;
echo "The Total Of Marks is: ".$sum;
echo "<br>";
echo "The Avarage Marks is: ".$avg;
echo "<br>";
echo "The Percentage: ".$percentage;
echo "<br>";
if($percentage >= 60){
echo "First Division";
}elseif ($percentage >= 45 && $percentage <= 59){
echo "Second Division";
}elseif ($percentage >= 33 && $percentage <= 44){
echo "Third Division";
}else{
echo "Fail";
}
}
?>