calculating average

• 10-11-2006
coolca
calculating average
Hi all,

I just joined the post. Iam new to C programming. I have a question regarding a problem i found in some book. The problem is i have a input file with student ID, 5 program scores, midterm and final score. i have to check for wrong input of data(negative score),calculate average score for program,calculate student totalscore (30% of programming,30% midterm,35%final and 5%free for whoever takes final exam),give grade to student and then finally compute calss total score.

print in a format to the output file.

My idea looks very simple to the problem. I think it may not that simple as i think. Please guide me.

-First we have to scan the details from input file
-if the score is > 0 and < 100 then
1)calculate average score for programs (total all score and divide by 5)
2) student total score i.e 30%*total program score+35%midterm+35%*final+5%
If Marks >=90 and <=100 then
Display grade = ‘A’

Else if marks >= 80 and <=89 then
Display grade = ‘B’

Else if marks >= 70 and <=79 then
Display grade = ‘C’

Else if marks >= 60 and <=69 then
Display grade = ‘D’

Else if marks >=0 and <=59 then
Do display grade = ‘F’

4) calculate total class score

Please let me know if iam write. If possible please tell me how to start writing C code for this

Thanks for your help
• 10-11-2006
Dave_Sinkula