How To Change Your Grades Javascript

223 103 76
                                    

FOR FURTHER ISSUES ON HACKING SERVICES, CONTACT US TODAY VIA AUTOMICHACKERSCREW@GMAIL.COM

JavaScript: Compute the average and grade of the studentsJavaScript Conditional Statement and loops: Exercise-6 with Solution

Write a JavaScript program which compute, the average marks of the following students Then, this average is used to determine the corresponding grade.

Student NameMarksDavid80Vinoth77Divya88Ishitha95Thomas68

The grades are computed as follows:

RangeGrade<60F<70D<80C<90B<100A

Pictorial Presentation:

Sample Solution:-

HTML Code:

<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Compute the average marks and grade</title>
</head>
<body>

</body>
</html>

Copy

JavaScript Code:

var students = [['David', 80], ['Vinoth', 77], ['Divya', 88], ['Ishitha', 95], ['Thomas', 68]];var Avgmarks = 0;for (var i=0; i < students.length; i++) {
Avgmarks += students[i][1];
var avg = (Avgmarks/students.length);
}console.log("Average grade: " + (Avgmarks)/students.length); if (avg < 60){
console.log("Grade : F");
}
else if (avg < 70) {
console.log("Grade : D");
}
else if (avg < 80)
{
console.log("Grade : C");
} else if (avg < 90) {
console.log("Grade : B");
} else if (avg < 100) {
console.log("Grade : A");
}

Copy

Sample Output:

Average grade: 81.6
Grade : B

Flowchart:

FOR FURTHER ISSUES ON HACKING SERVICES, CONTACT US TODAY VIA AUTOMICHACKERSCREW@GMAIL.COM

How To Change Your Grades JavascriptWhere stories live. Discover now