program statement: The  marks obtained by a student in 5 different subjects are input  through the keyboard. The student gets a division or grade as per the following rules: marks obtained by a student in 5 different subjects are input  through the keyboard. The student gets a division or grade as per the following rules:

Percentage above or equal to 60 – First

Percentage between 50 and 59 – Second

Percentage between 40 and 49 – Pass

Percentage less than 40 – Fail.

Write a program to calculate the division or grade obtained by the student.

source file name: studgrades.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 aggreate marks=%d and percentage=%f", total,percent);
if(percent>=60)
printf("\n Student gets First class");
if(percent>50 && percent<60)
printf("\n Student gets second  class");
if(percent>40&& percent <50)
printf("\n Student is Pass only");
if(percent<40)
printf("\n Student is Fail ");

getch();
}
 

output: