There was an error while loading. Please reload this page.
1 parent 3df7f57 commit faa527eCopy full SHA for faa527e
Learning/7. Challenges/4. Arrays/student-percentage-marks.c
@@ -0,0 +1,27 @@
1
+// Program to find the percentage obtained by a student.
2
+
3
+#include <stdio.h>
4
5
+int main() {
6
7
+ double marks[8];
8
9
+ // get input value for obtained marks
10
+ for (int i = 0; i < 8; i++) {
11
+ scanf("%lf", &marks[i]);
12
+ }
13
14
+ int totalMarks = 800;
15
+ double obtainedMarks = 0.0;
16
17
+ // find the sum of obtained marks
18
19
+ obtainedMarks = obtainedMarks + marks[i];
20
21
22
+ // find the percentage and print it
23
+ double percentage = obtainedMarks / 8;
24
+ printf("%.2lf", percentage);
25
26
+ return 0;
27
+}
0 commit comments