Program to calculate sum of 5 subjects and find percentage

Program to calculate sum of 5 subjects and find percentage:-
User Give input of Five Subject Marks,sum all subject marks and and multiply by 100 and divide by total marks

#include<stdio.h>
void main()
{
int s1,s2,s3,s4,s5,sum,total=500;
float per;

printf("enter marks of 5 subjects: \n");
scanf("%d%d%d%d%d",&s1,&s2,&s3,&s4,&s5);

sum=s1+s2+s3+s4+s5;

printf("sum is=%d\n",sum);
per=(sum*100)/total;
printf("percentage=%f",per);
}

Related Posts