I was given a problem,where I had to get the Semesteral Grade that is : 40% of Midterm + 60% of Final. Below is the code:
double Sgrade =(Mgrade * .40) +(Fgrade * .60);
I'm want to know, if this is the right way of getting the percentage?
Please see comments for explanation. Also side note I have renamed your variables using camelCase
let mGrade = 50 //assumes this is already a percent, otherwise you will need to convert percentage = (grade/total)*100;
let fGrade = 50 // assumes this is already a percent,, otherwise you will need to convert percentage = (grade/total)*100;
let sGrade = (mGrade*40/100) + (fGrade*60/100)
//percentage = (grade/total)*100;
console.log(sGrade);