Q:

C Program For Calculate Percentage Of More Than 6 Subjects

belongs to collection: Basic C Programs for Practice

0

 C Program For Calculate Total Marks Of More Than 6 Subjects And percentage. you need to calculate the percentage of marks and also print the marks of each subject.

Logic: First we will ask the user for the total number of the subject after that we will enter marks of all those subjects. Now we will calculate a percentage of marks and print student marks, percentage, and Grade of Student Percentage formula is given Below.
Percentage of Marks = (all subject marks sum) / Total Subject *100 .

 

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#include<stdio.h>

int main()
{
   int sub,marks,n,i,sum=0,tmp=0,arr[10],Percentage;

   printf("\nEnter number of subject : \n");
   scanf("%d", &n);
   
   tmp=n*100;
   
   printf("\nEnter The Marks: \n");
   for(i=0;i<n;i++)
   {
    scanf("%d", &arr[i]);
   }

   for(i=0;i<n;i++)
   {
    sum=sum+arr[i];
   } 
   
   Percentage = ( sum * 100 ) / tmp;
   
   printf("\nPercentage Of Student : %d\n", Percentage);

   return (0);

}

 

Output:

Enter number of subject : 

7

Enter The Marks: 

65

85

91

45

73

62

51

Percentage Of Student : 67

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

C Program For Converting Temperature Celsius Into ... >>
<< C Program For Find The Gross Salary of an Employee...