Explore BrainMass
Share

Explore BrainMass

    Efficient C program to compute letter grades

    This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

    Write an efficient C program using arrays, that reads a file consisting of students test scores in the range of 0-100, and outputs the Letter Grades and the number of students having got it, as per the following criteria:

    F : 0-19
    D : 20-39
    C : 40-59
    B : 60-79
    A : 80-100

    © BrainMass Inc. brainmass.com October 9, 2019, 7:07 pm ad1c9bdddf
    https://brainmass.com/computer-science/c/efficient-c-program-compute-letter-grades-108559

    Solution Preview

    We can also express the given letter grade and scores distribution as

    F : 20*0 - (20*0 + 19)
    D : 20*1 - (20*1 + 19)
    C : 20*2 - (20*2 + 19)
    B : 20*3 - (20*3 + 19)
    A : 20*4 - [(20*4 + 19) ...

    Solution Summary

    Solution not only gives an efficient C program that determines a letter grade using one comparison, but also explains the how/why of the logic behind it. A sample data file is also provided for testing convenience.

    $2.19