forked from singhofen/c-programming
-
Notifications
You must be signed in to change notification settings - Fork 0
/
findavegrades2.c
30 lines (26 loc) · 897 Bytes
/
findavegrades2.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/*Programmer Chase Singhofen
Date: 9/13/2016
Specifications: Finding average grades*/
//*Programmer directions
#include <stdio.h>
#include <stdlib.h>
main() // Mian Funtion
{
double t1 = 0, t2 = 0, t3 = 0, t4 = 0; // Variable Declaratives
double average = 0, A = 90, B = 80, C = 70, D = 60, F = 50;
printf("Enter the four test scores here \n"); //Prompting user to enter grades
scanf_s("%lf %lf %lf %lf ", &t1, &t2, &t3, &t4); // Input from user
average = (t1 + t2 + t3 + t4 / 4);
printf("The average grade is %.2lf \n", average); // Shows averge to user
if (average >= A)
printf("The letter grade is A \n");
else if (average >=B)
printf("The letter grade is B \n");
else if (average >=C)
printf("The letter grade is C \n");
else if (average >=D)
printf("The letter grade is D \n");
else
printf("The letter grade is F \n");
system("pause");
}