Thursday, 30 August 2012

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.


main()
{
 int s1,s2,s3,s4,s5,agr;
 float per;
 printf("Enter the marks of a student in five subject\n");
 scanf("%d%d%d%d%d",&s1,&s2,&s3,&s4,&s5);
 agr=s1+s2+s3+s4+s5;
 per=(float)agr/5;
 printf("He got %d marks in aggregate\n",agr);
 printf("He got %5.2f %c of marks",per,37);
}

output:-

No comments:

Post a Comment