-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUntitled-4.html
32 lines (29 loc) · 971 Bytes
/
Untitled-4.html
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
<html>
<body>
<h2>Student Grade Calculator</h2>
<p>Enter the student's mark:</p>
<input type="number" id="mark" min="0" max="100">
<button onclick="calculateGrade()">Calculate Grade</button>
<p id="result"></p>
<script>
function calculateGrade() {
var mark = document.getElementById("mark").value;
var grade = "";
if (mark > 100 || mark < 0) {
grade = "Invalid mark. Please enter a mark between 0 and 100.";
} else if (mark > 70) {
grade = "A";
} else if (mark >= 60) {
grade = "B";
} else if (mark >= 50) {
grade = "C";
} else if (mark >= 40) {
grade = "D";
} else {
grade = "E";
}
document.getElementById("result").innerHTML = "Grade: " + grade;
}
</script>
</body>
</html>