Student Marksheet Web Application: Utilize JavaScript to Calculate Subject Marks and Determine Grades

Posted by

Student Marksheet Web App

Student Marksheet Web App

Enter marks for each subject to calculate total marks and grade:

Total Marks:

Grade:

function calculateMarks() {
var maths = parseInt(document.getElementById(“maths”).value);
var science = parseInt(document.getElementById(“science”).value);
var english = parseInt(document.getElementById(“english”).value);

var totalMarks = maths + science + english;
document.getElementById(“totalMarks”).innerText = totalMarks;

var percentage = totalMarks / 3;
if (percentage >= 90) {
document.getElementById(“grade”).innerText = “A+”;
} else if (percentage >= 80) {
document.getElementById(“grade”).innerText = “A”;
} else if (percentage >= 70) {
document.getElementById(“grade”).innerText = “B”;
} else if (percentage >= 60) {
document.getElementById(“grade”).innerText = “C”;
} else if (percentage >= 50) {
document.getElementById(“grade”).innerText = “D”;
} else {
document.getElementById(“grade”).innerText = “F”;
}
}

0 0 votes
Article Rating
3 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
@kiranahmed862
7 months ago

Sir plz apna link again send krden

@HaleemUddin-jn8tr
7 months ago

Sir s ka tutorial lectures hi