Knowee
Questions
Features
Study Tools

Problem StatementA computer science teacher assigned the students a programming task that calculates and displays grades based on test marks. The teacher wants the program to take a student's test mark as input and determine their grade using the following criteria:If the mark is between 90 and 100 (inclusive), assign grade A.If the mark is between 80 and 89 (inclusive), assign grade B.If the mark is between 70 and 79 (inclusive), assign grade C.If the mark is between 60 and 69 (inclusive), assign grade D.If the mark is between 45 and 59 (inclusive), assign grade E.For marks below 45 assign grade F.If the mark is greater than 100 or a negative number, it displays "Invalid input". Help the students to accomplish the given task.Note: This question helps in clearing AMCAT exam.Input format :The input consists of a single integer, representing the student's mark.Output format :The output displays "Grade: " followed by the grade for the given mark based on the given criteria.If the mark is greater than 100 or a negative number, the output displays "Invalid input".Refer to the sample output for the formatting specifications.Code constraints :In the given scenario, the test cases fall under the following constraints:0 ≤ student's mark ≤ 100Sample test cases :Input 1 :100Output 1 :Grade: AInput 2 :85Output 2 :Grade: BInput 3 :79Output 3 :Grade: CInput 4 :63Output 4 :Grade: DInput 5 :56Output 5 :Grade: EInput 6 :0Output 6 :Grade: FInput 7 :-5Output 7 :Invalid inputInput 8 :126Output 8 :Invalid input

Question

Problem StatementA computer science teacher assigned the students a programming task that calculates and displays grades based on test marks. The teacher wants the program to take a student's test mark as input and determine their grade using the following criteria:If the mark is between 90 and 100 (inclusive), assign grade A.If the mark is between 80 and 89 (inclusive), assign grade B.If the mark is between 70 and 79 (inclusive), assign grade C.If the mark is between 60 and 69 (inclusive), assign grade D.If the mark is between 45 and 59 (inclusive), assign grade E.For marks below 45 assign grade F.If the mark is greater than 100 or a negative number, it displays "Invalid input". Help the students to accomplish the given task.Note: This question helps in clearing AMCAT exam.Input format :The input consists of a single integer, representing the student's mark.Output format :The output displays "Grade: " followed by the grade for the given mark based on the given criteria.If the mark is greater than 100 or a negative number, the output displays "Invalid input".Refer to the sample output for the formatting specifications.Code constraints :In the given scenario, the test cases fall under the following constraints:0 ≤ student's mark ≤ 100Sample test cases :Input 1 :100Output 1 :Grade: AInput 2 :85Output 2 :Grade: BInput 3 :79Output 3 :Grade: CInput 4 :63Output 4 :Grade: DInput 5 :56Output 5 :Grade: EInput 6 :0Output 6 :Grade: FInput 7 :-5Output 7 :Invalid inputInput 8 :126Output 8 :Invalid input

...expand
🧐 Not the exact question you are looking for?Go ask a question

Solution

This problem can be solved by using conditional statements in programming. Here is a step-by-step guide on how to solve it:

Step 1: Take the student's mark as input. Let's denote this as 'mark'.

Step 2: Check if the mark is greater than 100 or less than 0. If it is, print "Invalid input" and end the program.

Step 3: If the mark is not invalid, check if it is between 90 and 100 (inclusive). If it is, print "Grade: A".

Step 4: If the mark is not in the previous range, check if it is between 80 and 89 (inclusive). If it is, print "Grade: B".

Step 5: If the mark is not in any of the previous ranges, check if it is between 70 and 79 (inclusive). If it is, print "Grade: C".

Step 6: If the mark is not in any of the previous ranges, check if it is between 60 and 69 (inclusive). If it is, print "Grade: D".

Step 7: If the mark is not in any of the previous ranges, check if it is between 45 and 59 (inclusive). If it is, print "Grade: E".

Step 8: If the mark is not in any of the previous ranges, it means it is less than 45. In this case, print "Grade: F".

This way, the program will correctly determine and display the grade based on the student's mark.

This problem has been solved

Similar Questions

Write a Java program that determines a student’s grade. The program will read three types ofscores(quiz, mid-term, and final scores) and determine the grade based on the following rules: -if theaverage score >=90% =>grade=A -if the average score >= 70% and <90% => grade=B -if theaverage score>=50% and <70% =>grade=C -if the average score<50% =>grade=F

A student marking system receives input of student’s total mark from lecturer. If a studentgets total mark of 75 or above, the system will print ‘A’. If a student’s mark is between 65 to74, the system will print out ‘B’. While ‘C’ will be printed out if the mark is between 50 to 64.Whichever the total mark is below 50, ‘F’ will be printed

A school has following rules for grading system:           a. Below 25 - F               b. 25 to 45 - E             c. 45 to 50 - D               d. 50 to 60 - C          e. 60 to 80 - B              f. Above 80 -    A                                                                                                                     Ask user to enter marks and print the corresponding grade.

Accept the grades from the user and display the grade according to the following criteria:Below 25 --D25 to 45  -- C45 to 50 -- B50 to 60 --B+60 to 80 -- AAbove 80 -- A+

#include<stdio.h>#include<string.h>int main(){char b[100];scanf("%s",b);int a;scanf("%d",&a);printf("%s\n",b);printf("%d\n",a);if(a>=90&&a<100){printf("S Grade\n");}else if(a>=80&&a<90){printf("A Grade\n");}else if(a>=70&&a<80){printf("B Grade\n");}else if(a>=60&&a<70){printf("C Grade\n");}else if(a>=55&&a<60){printf("D Grade\n");}else if(a>=50&&a<55){printf("E Grade\n");}else if(a<50){printf("F Grade\n");}return 0;}

1/3

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.