C Program to Find Percentage of 5 Subjects

In this example we are going to find percentage of 5 Subjects. For this first of all marks of 5 subjects and then calculate Total Obtain marks and last we can calculate the percentage by given below formula.

Find percentage of 5 Subjects of any Student

#include<stdio.h>
void main()
{
  int hindi,english,acc,bs,ip;
  float totalMarks,per
  printf("Enter marks for Hindi : ");
  scanf("%d",&hindi);
  printf("Enter marks for English : ");
  scanf("%d",&english);
  printf("Enter marks for Account : ");
  scanf("%d",&acc);
  printf("Enter marks for Business Study : ");
  scanf("%d",&bs);
  printf("Enter marks for Informatics Practices : ");
  scanf("%d",&ip);  
  
  totalMarks = hindi+english+acc+bs+ip;

  per = (totalMarks * 100)/500;

  printf("Percentage of Student = %.2f",per);
}

Output

Enter marks for Hindi : 68
Enter marks for English : 62
Enter marks for Account : 73
Enter marks for Business Study : 75
Enter marks for Informatics Practices : 80
Percentage of Student = 71.60
 

Explanation

In above program we taken 5 subjects which are all have 100 maximum marks. So we have divided obtain marks by total maximum marks of all five subjects that is 500.

Share in a Single Click

Leave a Reply

Your email address will not be published. Required fields are marked *