Friday, June 23, 2006

Calculation of Total and Percentage

Calculates the total and percentage of the marks obtained in five subjects by a student. The marks obtained are to be entered by the student.

If the marks obtained by a student in five different subjects are input
through the keyboard, find out the aggregate marks and percentage marks obtained
by the student. Assume that the maximum marks that can be obtained by a student in each
subject is 100.


int m1, m2, m3, m4, m5, total;
float percentage;

printf ("Enter the marks obtained by the student in all the five subjects: ");
scanf ("%d %d %d %d %d", &m1, &m2, &m3, &m4, &m5);

total= m1+m2+m3+m4+m5;
percentage = total/5;

printf ("\nThe aggregate marks obtained by the student are: %d", total);
printf ("\nThe percentage obtained by the student are %f", percentage);


The File can be found at:
Download File

No comments: