0

Can anyone suggest me name of function that I can use in code

// a program calculate that your marks are above average or not. function name() { let own_marks = parseFloat(prompt("Enter your own marks")); const students = parseFloat(prompt("Enter number of student in your class")); //take marks of your classmates let arr = []; let sum = 0; for(var i = 1; i<=students; i++){ let input = parseFloat(prompt(`Enter ${i}'s student value`)); arr.push(input); sum += arr[i-1] } // calculate average let ave = sum/students; if (own_marks <= ave){ console.log(false); } else { console.log(true); } } name()

24th Jan 2023, 11:47 AM
Girish Sahu
Girish Sahu - avatar
1 Answer