Saturday, January 30, 2010

CHAP 1[H]c Finding aggregate and percentage marks

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.

void main()
{
float a,b,c,d,e,t,am,pm;
printf("\nInput the 5 test marks followed by total obtainable marks");
scanf("%f%f%f%f%f%f",&a,&b,&c,&d,&e,&t);
am=(a+b+c+d+e)/5;
pm=(am/t)*100.0;
printf("\nThe aggregate marks is %f\nThe percentage marks is %f",am,pm);
}

1 comment:

  1. The person should be able to enter the maximum of 100 marks per subject but according to your coding , he can put more than 100 and the total to less .. so i think the coding doesn't satisfied the question fully !

    ReplyDelete