You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
780 B
JavaScript

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);
}
alert("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");
}