You are on page 1of 1

<!

DOCTYPE html>
<html>
<head>
<title>Student Information</title>
</head>
<body>
<h2>Student Information</h2>
<table border="1">
<tr>
<th>Name</th>
<th>Total Marks</th>
<th>Grade</th>
</tr>
</table>
<script>
for (let i = 0; i < 5; i++) {
const studentName = prompt("Enter the student name:");
const htmlMarks = parseFloat(prompt("Enter HTML marks:"));
const cssMarks = parseFloat(prompt("Enter CSS marks:"));
const jsMarks = parseFloat(prompt("Enter JavaScript marks:"))

const totalMarks = htmlMarks + cssMarks + jsMarks;

let grade;
if (totalMarks >= 90) {
grade ='A+';
}
else if (totalMarks >= 80) {
grade = 'A';
} else if (totalMarks >= 70) {
grade = 'B';
} else if (totalMarks >= 60) {
grade = 'C';
} else if (totalMarks >= 50) {
grade = 'D';
} else {
grade = 'F';
}

const table = document.querySelector('table');


const row = table.insertRow(-1);
const cell1 = row.insertCell(0);
const cell2 = row.insertCell(1);
const cell3 = row.insertCell(2);

cell1.innerHTML = studentName;
cell2.innerHTML = totalMarks;
cell3.innerHTML = grade;
}
</script>
</body>
</html>

You might also like