In this article, we will discuss the c program to calculate percentage of 5 subjects and also how to find the total of 5 subjects. This problem requires prior knowledge of Mathematics and basic knowledge of C programming language.

Calculating the percentage of 5 subjects is not a complicated task, you just have to sum up all the marks and perform multiplication with 100 on it. After that, divide it with the total maximum marks a student can obtain. At last, you will get the result as the percentage of the 5 subjects.

## Algorithm to Write C Program to Calculate Percentage of 5 Subjects

- Read five subject marks and store them into 5 different variables.
- Calculate sum of all subjects and store in total = eng + phy + chem + math + comp.
- Divide sum of all subjects by total number of subjects to find average i.e. average = total / 5.
- Calculate percentage using percentage = (total / 500) * 100.
- Finally, print resultant values total, average and percentage.

## Code Implementation for C Program to calculate percentage of 5 subjects

#include <stdio.h> int main() { float eng, phy, chem, math, comp; float total, average, percentage; printf("Enter marks of five subjects: :- "); scanf("%f%f%f%f%f", &eng, &phy, &chem, &math, &comp); total = eng + phy + chem + math + comp; average = total / 5.0; percentage = (total / 500.0) * 100; printf("Total marks = %.2f\n", total); printf("Average marks = %.2f\n", average); printf("Percentage = %.2f", percentage); return 0; }

### Time Complexity

O(1) will be the time complexity for the c program to calculate percentage of 5 subjects as it requires mathematical calculations.

**Conclusion**

Hoping this article has discussed c program to calculate percentage of 5 subjects will give you a clear idea for that. For the starting phase of the coding career, problems like calculating the percentage of 5 subjects will build your logic and confidence which will encourage you to solve more coding questions.

**Other C Programs**

C program to add two numbers

C program to convert binary number to decimal number

C program to convert celsius to fahrenheit

C program to convert infix to postfix

C program to find area of circle

C program to find roots of quadratic equation

C program to reverse a number

C program for merge sort for linked lists

C program for performing bubble sort on linked list

C program to reverse a linked list