Thread: calculating average

  1. #1
    Registered User
    Join Date
    Oct 2006

    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%
    3)calculating grade
    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

  2. #2
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Moving Average Question
    By GCNDoug in forum C Programming
    Replies: 4
    Last Post: 04-23-2007, 11:05 PM
  2. Debug Error Really Quick Question
    By GCNDoug in forum C Programming
    Replies: 1
    Last Post: 04-23-2007, 12:05 PM
  3. Calculating an average
    By Andy123 in forum C Programming
    Replies: 11
    Last Post: 03-02-2006, 10:40 AM
  4. calculating average
    By Sharlene in forum C++ Programming
    Replies: 3
    Last Post: 12-08-2003, 03:10 PM
  5. Problem calculating average with "for"...
    By davidvoyage200 in forum C++ Programming
    Replies: 3
    Last Post: 10-25-2002, 10:02 AM