Home  • Programming • JavaScript

JavaScript program which takes a score and will print the grade

Code Solutions [4384] Problem Definition Make a JavaScript program which takes a score and will print the grade as the following criteria: a. If score is greater or equal 90 and less or equal 100 than will print A b. If score is greater or equal 80 and less or equal 89 than will print B c. If score is greater or equal 70 and less or equal 79 than will print C d. Otherwise will print F Code
<script>
score= parseInt(prompt("Enter your score"));
if(score>=90 && score<=100){
   document.write("A");
}else if(score>=80 && score<=89){
  document.write("B");
} else if(score>=70  && score<=79){
  document.write("C");
}else{
 document.write("F");
}
</script>
Input 78 Output C

Comments 1


helpful code
Copyright © 2024. Powered by Intellect Software Ltd