C Program For Calculate Percentage Of 5 Subjects

#include<stdio.h>
#include<conio.h>
void main()
{
    int s1,s2,s3,s4,s5,total=500,sum=0;
    float per;
    clrscr();
    printf("Enter Marks of 5 Subjects: ");
    scanf("%d%d%d%d%d",&s1,&s2,&s3,&s4,&s5);
    sum=s1+s2+s3+s4+s5;
    printf("Sum of 5 Subjects is: %d\n",sum);
    per=(sum*100)/total;
    printf("Percentage is: %f",per);
    getch();
}

Output

Enter Marks of 5 Subjects: 80 70 85 83 90
Sum of 5 Subjects is: 408
Percentage is: 81.000000

Leave a Comment