forked from singhofen/c-programming
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gradesforclass.c
45 lines (32 loc) · 899 Bytes
/
gradesforclass.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*Programmer Chase Singhofen
Date: 9/13/2016
Specifications: Finding average grades*/
//*Programmer directions
#include <stdio.h>
#include <stdlib.h>
//main funtion
main()
{
//Variable declarations
double grade1, grade2, grade3, avg;
//user input
printf("Enter three grades:\n");
scanf_s("%lf %lf %lf", &grade1, &grade2, &grade3);
//check
printf("grades entered are %.2lf, %.2lf, %.2lf\n", grade1, grade2, grade3);
//process
avg = (grade1 + grade2 + grade3) / 3;
printf("Average of the grades %.2lf %.2lf %.2lf is %.2lf\n", grade1, grade2, grade3, avg);
if (avg >= 90)
printf("Your grade is A \n");
else if (avg >= 80)
printf("Your grade is B \n");
else if (avg >= 70)
printf("Your grade is C \n");
else if (avg >= 60)
printf("Your grade is D \n");
else
printf("Your grade is F \n");
system("pause");
}
//end main