Skip to content

Commit faa527e

Browse files
Add files via upload
1 parent 3df7f57 commit faa527e

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
for (int i = 0; i < 8; i++) {
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

Comments
 (0)