    Wrox Programmer Forums calculating gpa with only grades?
 | Search | Today's Posts | Mark Forums Read
 C# 2012/5.0 General Discussion Discussions about the C# 2012 language and tool not related to any specific Wrox book
 Welcome to the p2p.wrox.com Forums. You are currently viewing the C# 2012/5.0 General Discussion section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com

avavida Registered User
 Points: 10, Level: 1   Activity: 0%   Join Date: May 2017
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts calculating gpa with only grades?

is there some sort of calculation for just GPA without knowing the credits? i wrote a program which shows the average 20students have each after taking 3 exams each. now i must print the GPA of each student, as well as which has the highest GPA. i looked up some formulas via google search and didn't find much because the way GPA is calculated involves the credits taken.
code:
#include<stdio.h>
int main()
{
float exam_a = { 77, 65, 89, 79, 85, 90, 98, 45, 83, 75, 71, 85, 85, 80, 68, 72, 56, 82, 63, 80} ;
float exam_b = { 87, 92, 84, 89, 75, 99, 92, 66, 80, 77, 56, 79, 76, 78, 88, 78, 66, 70, 69, 90} ;
float exam_c = { 45, 77, 87, 77, 88, 83, 94, 71, 73, 83, 52, 80, 93, 88, 76, 64, 75, 80, 85, 52} ;
int k;
char letter;
float student;
float sum_a = 0, sum_b = 0, sum_c = 0, sum_d = 0, sum_f = 0;
int tot_a = 0, tot_b = 0, tot_c = 0, tot_d = 0, tot_f = 0;
for (k = 0; k < 20; ++k){
sum_a = sum_a + exam_a[k];
student[k] = exam_a[k] + exam_b[k] + exam_c[k];
student[k] = (student[k])/3;

if (student[k] >= 90){
letter = 'A';
++tot_a;
}
else if (student[k] >= 80){
letter = 'B';
++tot_b;
}
else if (student[k] >= 70) {
letter = 'C';
++tot_c;
}
else if (student[k] >= 60) {
letter = 'D';
++tot_d;
}

else {
letter = 'F';
++tot_f;
}
}
printf("(Based on Averages)Number of As = %i \number of Bs = %i \number of Cs = %i \number of Ds = %i \number of Fs = %i \n", tot_a, tot_b, tot_c, tot_d, tot_f);

}
is to show which students got what grades on the average of 3 exams. i was thinking of maybe just doing if 95 and over store 4.0 90 and over store 3.7 and so on.. unless theres a better way to calculate this.
Example: https://gpahub.net Similar Threads Thread Thread Starter Forum Replies Last Post GPA Calculator Final Method IsoftTech C# 2012/5.0 General Discussion 4 June 14th, 2018 05:40 AM Need help with Sorting grades. Raunom123 Visual Basic 2010 General Discussion 0 June 15th, 2014 03:01 PM Students,Courses, and Grades frdata BOOK: Beginning Database Design Solutions ISBN: 978-0-470-38549-4 11 May 11th, 2014 11:00 AM GPA Calculator xenoalien C# 1 November 30th, 2007 03:25 AM Calculating ashik112 ASP.NET 1.0 and 1.1 Basics 2 February 14th, 2007 12:49 PM 