/*To read marks of 4 subjects and find out how many students fall
under the following categories:
a) avg<45 - Fail
b) 45 <= avg <55- Third Division
c) 55<= avg <60 - Second Division
d) 60<= avg <75 - First Division
e) avg >=75 - Distinction
*/
#include<stdio.h>
#include<conio.h>
main()
{
int f=0,t=0,s=0,F=0,d=0,n,i;
float fcp,iit,cag,stat;
printf("Enter the number of students\n");
scanf("%d",&n);
float avg[n];
for(i=0;i<n;i++)
{
printf("Enter marks of FCP , IIT , CAG , STAT respectively of %dth student\n",i+1);
scanf("%f%f%f%f",&fcp,&iit,&cag,&stat);
avg[i]=(fcp+iit+cag+stat)/4;
printf("Avrage=%f\n",avg[i]);
}
for(i=0;i<n;i++)
{
if(avg[i]<45)
f++;
if(avg[i]<75 && avg[i]>=60)
F++;
if(avg[i]<55 && avg[i]>=45)
t++;
if(avg[i]<60 && avg[i]>=55)
s++;
if(avg[i]>=75)
d++;
}
printf("The number of students with distinction = %d\n",d);
printf("The number of students with first division = %d\n",F);
printf("The number of students with second division = %d\n",s);
printf("The number of students with third division = %d\n",t);
printf("The number of failed students = %d\n",f);
getch();
}
No comments:
Post a Comment