Thursday 24 February 2022

C Program To Calculate Percentage (%) of Marks

 CALCULATE PERCENTAGE OF MARKS

Code :

#include<stdio.h>

int main()
{
    float marks[5], total=0, per=0;
   
    printf("Enter your top 5 subjects marks:\n\n");  
    for(int i=0; i<5; i++)
    {
       printf("Enter marks of subject %d: ", i+1);
       scanf("%f", &marks[i]);
       total += marks[i];
     
    }
    per = total/5;
   
    printf("\nPercentage = %.2f %%\n", per);
    return 0;
}

Come again Learn again !

< iCodeBuzz />


No comments:

Post a Comment