1 Using loops, input marks of 5 students and display the average maris
Answers
Answer:
make me as brianlist
Explanation:
program to enter the marks of five subjects and calculate total, average, and percentage
Author: Admin
Last Updated: 2020-09-30
Category: C
C program to enter the marks of five subjects and calculate total, average, and percentage. There are you will learn how to find the total, average, and percentage value of the five subjects in C language.
Formula:
total = p + c + m + e + h
average = total / 5.0
percentage = (total / 500.0) * 100
Where:
p, c, m, e, and h are the five subjects
Let us understand this example through C program:
/* C program to enter the marks of five subjects and calculate total, average, and percentage */ #include <stdio.h> int main() { float p, c, m, e, h, total, average, percentage; // p, c, m, e, and h are the five subjects // p = physics // c = chemistry // m = math // e = english // h = history printf("Enter the marks of five subjects::\n"); scanf("%f%f%f%f%f", &p, &c, &m, &e, &h); // Calculate total, average and percentage total = p + c + m + e + h; average = total / 5.0; percentage = (total / 500.0) * 100; // Output printf("The Total marks = %.2f/500.00\n", total); printf("The Average marks = %.2f\n", average); printf("The Percentage = %.2f%%", percentage); return 0; }
Output Screen:
Enter the marks of five subjects::
95
85
74
64
53
The Total marks = 371.00/500.00
The Average marks = 74.20
The Percentage = 74.20%