Accept marks obtained by a student in 5 different subjects and calculate the total and percentage. Assume marks to be out of 100 and integer values.

#include <stdio.h>

int main(void)
{
int m1, m2, m3, m4, m5, total;
float percent;

printf("\nEnter marks in 5 subjects : ");
scanf("%d%d%d%d%d", &m1, &m2, &m3, &m4, &m5);

total = m1 + m2 + m3 + m4 + m5;
percent = total*100/500;
//percent = total/500*100;
//percent = total/5.0;

printf("\nTotal = %d", total);
printf("\nPercentage = %f", percent);

return 0;
}

No comments:

Post a Comment

kiss on google ads if you are anonymous because your ip is trackable.thank you.

......from.admin