Answer to Question #159428 in C for Faiza Ali

Question #159428

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.



1
Expert's answer
2021-01-29T01:26:07-0500
#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;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS