Write a C program to read marks of a student for 3 subjects (Math, Chemistry and Computer Science) from keyboard. The program should calculate the total and average marks for the student.
1
Expert's answer
2011-07-01T18:13:47-0400
#include <stdio.h> #include <conio.h>
char get_user_answer();
int main() { int markForMath, markForChemistry, markForCompScience; do { & int total; & system("cls"); & printf("Enter the mark for Math: "); & scanf("%d", &markForMath); & printf("Enter the mark for Chemistry: "); & scanf("%d", &markForChemistry); & printf("Enter the mark for Computer Science: "); & scanf("%d", &markForCompScience); & total = markForMath + markForChemistry + markForCompScience; & printf("The total mark: %d\n", total); & printf("The average mark: %.2f\n", (float)total / 3); } while (get_user_answer() != 'n'); return 0; }
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
Comments
Leave a comment