Program to calculate sum of 5 subjects and print percentage

#include<stdio.h>
void main()
{
int eng, hin, maths, sci, comp, sum, total=500;
float per;
printf("Enter marks obtained in 5 subjects:");
scanf("%d%d%d%d%d", &eng, &hin, &maths, &sci, &comp);
sum= eng+hin+maths+sci+comp;
printf("Sum=%d",sum);
per=(sum*100)/total;
printf("Percentage= %f", per);
}

Post a Comment

0 Comments