May 26, 2023
Program to use Student of Result JavaScript Language
let Math = 57;
let English = 68;
let Computer = 76;
let Total;
let Percentage;
let Grade;
Total = Math + English + Computer;
console.log("Total of Student Number =", Total);
Percentage = Total / 3;
console.log("Percentage of Student Number =", Percentage.toFixed(2));
if (Percentage > 80 && Percentage <= 100) {
console.log("Grade A+");
}
else if (Percentage > 60 && Percentage < 80) {
console.log("Grade = A");
}
else if (Percentage > 45 && Percentage <= 60) {
console.log("Grade = B");
}
else if (Percentage > 33 && Percentage < 45) {
console.log("Grade = C");
}
else if (Percentage > 0 && Percentage < 33) {
console.log("Grade = F");
}
Output
Total of Student Number = 201
Percentage of Student Number = 67.00
Grade = A
Steps Description
- Declare six variables
Math, English, Computer, Total, Percentage
andGrade
- Initialize six variables with value of 57, 68, 76 respectively
Math=57, English=68, Computer=76, Total, Percentage
andGrade
- Variable math, variable english and variable computer are three variables which are added with the help of addition operator.
- Three variables add value to total variable with the help of assignment operator
- Percentage = (assignment operator) variable Total / (division operator) 3;
- if statement Percentage > 80 && Percentage <= 100 display Grade A+
- else if statement Percentage > 60 && Percentage < 80 display Grade A
- else if statement Percentage > 45 && Percentage < 60 display Grade B
- else if statement Percentage > 33 && Percentage < 45 display Grade C
- else if statement Percentage > 0 && Percentage < 33 display Grade F
console.log
inbuild function to displayTotal
variable numberPercentage
variable number andGrade
variable alphabet
by : Suhel Akhtar
Quick Summary:
Program to use Addition ( + ) Operator Division ( / )Operator AND ( && ) Operator if statement else if statement use Student of Result Total, Average, Grade JavaScript Language