Make a mark sheet of a student who is enrolled in five subjects. Marks of each subject should be defined by the user. The Output should contain the percentage obtained in each subject, Total marks obtained, Total Marks and percentage attained by the student.
#include <stdio.h>
int main() {
int subject_scores[5];
int total_score = 0;
// the max score is 50
printf("Please enter the marks lees than 50\n");
for (int i = 0; i < 5; i++) {
printf("Enter the mark %d - subject: ", i + 1);
scanf("%d", &subject_scores[i]);
total_score += subject_scores[i];
}
for (int i = 0; i < 5; i++) {
printf("The percentage of the obtained of the %d - subject is %f \n", i + 1, subject_scores[i] * 100 / 50.0);
}
printf ("the total score is %d", total_score);
printf("\nthe percentage of whole subject %f", total_score * 100 / 250.0);
return 0;
}
Comments
Leave a comment