Xiao Ming has a total of 5 courses this semester, namely English, Chinese, maths, history and music. The mid-term examinations of 5 subjects were 86 points, 74 points, 92 points, 77 points, 82 points, and the final exam results were 81 points, 87 points, 90 points, 62 points and 88 points respectively. Known midterm and final exam scores accounted for 30% and 70% of the total score respectively. Define the corresponding variables to store the scores of each subject, and calculate the total score of Xiao Ming's 5 courses in peace and sharing. Requires an average output of two forms: a floating-point number with 2 decimal places and an integer form without decimals. A floating-point number with a 2-bit decimal number is required for total output. The data types of floating-point numbers in the program are float types.
Tips:
An integer that outputs an average score without a decimal can use coercion type conversions.
The following are examples of output:
total=408.90
average=81.78
average=81
input format: None
output Format:
Output Total score format: "total=%.2f\n"
Format of output average: "average=%.2f\n"
"Average=%d\n"
#include <stdio.h>
int main ()
{
float total,average;
Total= (86+74+92+77+82) *0.3+ (81+87+90+62+88) *0.7;
AVERAGE=TOTAL/5;
printf ("total=%.2f\n", total);
printf ("average=%.2f\n", average);
return 0;
}