C Program for Total, Average, and Percentage of Five Subjects

In this tutorial you will learn about the C Program for Total, Average, and Percentage of Five Subjects and its application with practical example.

C Program for Total, Average, and Percentage of Five Subjects

In this tutorial, we will learn to create a C program that will find the Total, Average, and Percentage of Five Subjects using C programming.

Prerequisites

Before starting with this tutorial, we assume that you are the best aware of the following C programming topics:

  • Operators in C Programming.
  • Basic Input and Output function in C Programming.
  • Basic C programming.
  • Arithmetic operations in C Programming.

What is a percentage of numbers?

The percentage of all the marks is calculated by adding the total marks. And then we will divide it by the maximum marks and multiplied by 100.

What is the average of numbers?

The average of numbers in mathematics means that all the numbers are added and then the sum of all the numbers is divided by the total number of objects.

It means if there are 5 subject marks as follows {60,60,60,80,70} then the average will be:-

average = 60+60+60+80+70/5

average = 60.

Algorithm:-

Program to calculate total, Average, and Percentage of Five Subjects.

In this program, we will first take the marks of all five subjects from the user. And then we will add them to find the total marks. Now the total will be divided by the number of subjects to find the average.  Then the total will be divide by maximum marks and multiply by 100. Last, we will print the outputs.

Example using the below program.

Program Code:-

Output:-

In the above program, we have first initialized the required variable.

  • eng = it will hold the float value.
  • chem = it will hold the float value.
  • phy = it will hold the float value.
  • math = it will hold the float value.
  • comp = it will hold the float value.
  • total = it will hold the float value.
  • average = it will hold the float value.
  • percentage = it will hold the float value.

Input number from the user.

Program Logic Code.

Printing output.

In this tutorial we have learn about the C Program for Total, Average, and Percentage of Five Subjects and its application with practical example. I hope you will like this tutorial.