Question
/* Instructions: * * 1. Write a program in C to assign a grade to Student. Get the number of assignments from user. Get the
/* Instructions:
*
*
1. Write a program in C to assign a grade to Student.
Get the number of assignments from user.
Get the students score out of how many points for each assignment.
Calculate percentage and return the grade associated with a range of marks.
2. The overall score range and the associated grades are as follows:
a. [97-100] = A+
b. [90-97] = A
c. [80-90] = B
d. [70-80] = C
e. less than 70 is a failing grade and should be given an F
e. greater than 100 or less than 0 is invalid and your code should print "Invalid"
3. Use the skeleton code provided below to create a new function "printGrade" to assign a grade based on the score ranges.
4. Use print statements in your function to display the grade. For example, if the input marks is 77, the output should read:
"Your grade is : C"
5. Please adhere to standard C syntax conventions and use comments to explain your code. Failure to do so will result in a penalty.
*
*
* */
#include
void printGrade(int score){
//print the students grade based on their score in the class
}
int main(void){
char ch;
float score;
int assignments;
do {
printf("How many assignments did you have ? ");
//get the number of assignments from the student
printf("Enter your score for all assignments : " );
//get the number of assignments from the student
printf("Enter your score for all assignments : " );
//get the student's score and the max score for each assignment
//calculate the student's percentage in the class using the information you've gathered.
int percent;
printGrade(percent);
printf(" Do you want to continue? (Y/N) ");
scanf(" %c",&ch);
} while(ch == 'y'|| ch == 'Y');
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started