Here is the student grade calculator using pure HTML, CSS & JS. In Web Format You can enter Some marks on some subjects and you can get total marks, percentage and Grade of Student
constgetResult=()=>{letmath=document.getElementById('math').value;letphysics=document.getElementById('physics').value;letchemistry=document.getElementById('chemistry').value;letc=document.getElementById('cprogramming').value;letcomputer=document.getElementById('computer').value;if(document.getElementsByTagName('input').value==""){alert("Please Enter Some Value");}lettotal=parseFloat(math)+parseFloat(physics)+parseFloat(chemistry)+parseFloat(c)+parseFloat(computer);letpercentage=(total*100)/500;if(percentage>=90){document.getElementById("grade").innerHTML="A+";}elseif(percentage>=80){document.getElementById("grade").innerHTML="A";}elseif(percentage>=70){document.getElementById("grade").innerHTML="B+";}elseif(percentage>=60){document.getElementById("grade").innerHTML="B";}elseif(percentage>=50){document.getElementById("grade").innerHTML="B+";}elseif(percentage>=40){document.getElementById("grade").innerHTML="C+";}elseif(percentage>=30){document.getElementById("grade").innerHTML="C";}elseif(percentage>=20){document.getElementById("grade").innerHTML="D+";}else{document.getElementById("grade").innerHTML="You Are Failed";}document.getElementById('percentage').innerHTML=percentage;document.getElementById('total').innerHTML=total;}
Top comments (2)
Can I also use the font, background and code colors on this page in my visual studio?
copy code and
you can customize yourself