"I want to write a program that determine a student’s grade. It reads three test scores (between 0-100) and calls a function the calculate and return a student’s grade based on following rules:
(a) If the average score is 90% and more, the grade is ‘A’
(b) If the average scores 70% or more & less than 90%, it checks the third score. If the third score is more than 90%, the grades is ‘A’ otherwise than grade is ‘B’
(c) If the average score is 50%, it checks the average of second & third scores. If the average of them is greater than 70%, the grade is ‘C’, otherwise it is ‘D’.
(d) If the average score is less than 50%, then the grade is ‘F’

The program’s main() contains only call statements. At least 3 subfunctions are required:
1. One function to read score
2. One to determine the grade
3. One to print the result

## All 6 Replies

I'm new..please teach me if i wrong.. i'm still learning. sorry for my effort.

I'm new..please teach me if i wrong.. i'm still learning. sorry for my effort.

The point is you're NOT making an effort. This isn't a "Hello World" program, so I assume you already know how to call a function. So set up a skeleton of three empty functions that do nothing but return the correct data type, call them from main, and then we can go from there. You may not know know how to do the whole thing, but at least do something.

i try it for a day but i don't get it.. sorry to tell you i don't know how to call function. this is how i do this day,

``````#include <stdio.h>
int main (void)
{
float calculateAverageScore(float score1, float score2, float score3);
float scoreOne, scoreTwo, scoreThree;
scanf("%f%f%f",&scoreOne,&scoreTwo,&scoreThree);
return 0;
}
float calculateAverageScore(float score1, float score2, float score3)
{
float average;
average=(score1+score2+score3)/3;
scanf("%f",&average);
if(average>=90);
if(average<=90);
return (average);
}``````

Code tags.

[code]

// paste code here

[/code]

or

[code=cplusplus] // paste code here

[/code]

``````#include <stdio.h>
int main (void)
{
float calculateAverageScore(float score1, float score2, float score3);
float scoreOne, scoreTwo, scoreThree;
scanf("%f%f%f",&scoreOne,&scoreTwo,&scoreThree);
return 0;
}
float calculateAverageScore(float score1, float score2, float score3)
{
float average;
average=(score1+score2+score3)/3;
scanf("%f",&average);
if(average>=90);
if(average<=90);