-
Notifications
You must be signed in to change notification settings - Fork 18
/
problem3Function.c
56 lines (35 loc) · 1019 Bytes
/
problem3Function.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
46
47
48
49
50
51
52
53
54
55
56
/*programmer chase
instructions - write C program that allows the user
to enter 3 grades from student and displays the average and
percentage*/
#include<stdio.h>
#include<stdlib.h>
double askPoints() {
double grade;
printf("input a grade\n");
scanf_s("%lf", &grade);
return grade;
}
double avgPoints(double a, double b, double c) {
double avg;
avg = (a + b + c) / 3;
return avg;
}
void display(double x, double y) {// not retuning any value (void)
printf("the average is %.2lf, the percentage is%.2lf\n",x, y);
}
double percentPoints(double a, double b, double c) {
double per;
per = (a + b + c) / 3;
return per;
}
main() {
double num1, num2, num3, num4, num5;
num1 = askPoints();//invoked each num or int
num2 = askPoints();
num3 = askPoints();
num4 = avgPoints(num1, num2, num3);//passing by value. passing by variables all 3 arguments.
num5 = percentPoints(num1, num2, num3);
display(num4, num5);
system("pause");
}