Answer :
Answer:
Following are the java script code for the above question.
Explanation:
Program :
var percentage= prompt("Enter the percentage of the student"); // take the input from the user.
if(percentage>=90)//check condition for greator than 90.
alert("your grade is \"A\"");
else if(percentage>=80) // check condition for 80 and 89.
alert("your grade is \"B\"");
else if(percentage>=70) // check condition for 70 and 79.
alert("your grade is \"C\"");
else if(percentage>=60) // check condition for 60 and 69.
alert("your grade is \"D\"");
else // check condition for less than 60.
alert("your grade is \"F\"");
Output:
- If the user input 60, it will prints D.
- If the user inputs 59, it will prints f.
Code Explanation:
- The above code is in a javascript language, In which the first line is used to display the message and take the input from the user in the alert box.
- Then the percentage is checked by the help of in if, else if and else statement and print the grade.
- Then the grade is printed with the help of an alert box.