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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
|
#include <stdio.h>
void PrintGreetings()
{
printf("Final grade is ");
}
int calc(int grade, int h, int c, int q, int f);
int main()
{
int hn[12], cn, qn, fn;
int h, c, q, f;
int s;
int grade;
printf("how many homeworks: ");
scanf("%d", &hn[]);
for(s=1; s<=hn[]; s++)
{
printf("enter homework grade:");
scanf("%d", &h);
}
printf("how many classworks: ");
scanf("%d", &cn);
for(s=1; s<=cn; s++)
{
printf("enter classwork grade:");
scanf("%d", &c);
}
printf("how many quizzes: ");
scanf("%d", &qn);
for(s=1; s<=qn; s++)
{
printf("enter quiz grade:");
scanf("%d", &q);
}
printf("enter 1 if the final is completed: ");
scanf("%d", &fn);
if(fn == 1)
{
printf("enter grade:");
scanf("%d", &f);
}
else if(fn != 1)
{
printf("you have no final exam grade\n");
}
grade = calc(0, h, c, q, f);
printf("final grade: %d\n", grade);
return 0;
}
int calc(int grade, int h, int c, int q, int f)
{
grade= .16*c + .24*h + .3*q + .3*f;
PrintGreetings();
return grade;
}
|