Program statement:

 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.

source file name: avgpercent.C

void main()
{
int p1,p2,p3,p4,p5;
int total=0;
float percent;
clrscr();
printf("aggregate and percentage   program");
printf("\n enter 5 different subjects marks");
scanf("%d%d%d%d%d",&p1,&p2,&p3,&p4,&p5);
total=p1+p2+p3+p4+p5;
percent=total/5;
printf("\n aggregate marks=%d and percentage=%f", total,percent);
getch();
}
 

Output:

1.  aggregate and percentage   program

 enter 5 different subjects marks

55 60 65 70 75 

2. aggregate marks=325 and percentage=65.00

 aggregate and percentage   program

 enter 5 different subjects marks

67 76 73 65 56

aggregate marks=337 and percentage=67.000