C Program that calculates GPA Posted by Samath 1727 February 08, 2017

This is a GPA calculator that was programmed using the C programming language. The program ask the user for as many grades as the user wishes to calculate, and calculate the final gpa for the grades entered. Feel free to use this program for whatever you wish, if you have any question leave it in the comment section below.

```#include <stdio.h>
#include <string.h>
#include <conio.h>

int main(int argc, char *argv[])
{

const double A = 4.0;
const double A_MINUS = 3.67;
const double B_PLUS = 3.33;
const double B = 3.0;
const double B_MINUS = 2.67;
const double C_PLUS = 2.33;
const double C = 2.0;
const double C_MINUS = 1.67;
const double D = 1.00;
const double F = 0.0;

double credit;
double caltimes = 0;
double totalcal = 0;
double totalcredit = 0;
double finalgpa = 0;
int option;

for (;;)
{

printf("Enter the course credit: ");
scanf("%d", &credit);

{
caltimes = credit * A;
}
{
caltimes = credit * A_MINUS;
}
{
caltimes = credit * B_PLUS;
}
{
caltimes = credit * B;
}
{
caltimes = credit * B_MINUS;
}
{
caltimes = credit * C_PLUS;
}
{
caltimes = credit * C;
}
{
caltimes = credit * C_MINUS;
}
{
caltimes = credit * D;
}
{
caltimes = credit * F;
}
else
{
printf("Invaild Input...");
}

totalcredit = totalcredit + credit;
totalcal = totalcal + caltimes;

printf("Do you want to enter another grade (1 - Yes, 2 - no): ");
scanf("%d",&option);
if (option == 1)
{
continue;
}
else
{
break;
}
}

finalgpa = totalcal / totalcredit;
printf("Student's GPA: %f\n", finalgpa);

return 0;
}
```