First Method:
#include <stdio.h>
int main() {
float e,m,s,t,a;
printf("Enter English,Maths,Science marks:");
scanf("%f %f %f",&e,&m,&s);
t=e+m+s;
a=t/3;
printf("Total=%.2f,Average=%.2f\n",t,a);
if(a>=70)
printf("Distinction");
else if(a>=60)
printf("First Class");
else if(a>=50)
printf("Second Class");
else if(a>=35)
printf("Pass Class");
else
printf("Fail");
}
Second Method:
#include <stdio.h>
int main() {
float e,m,s,t,a;
printf("Enter English,Maths,Science marks:");
scanf("%f %f %f",&e,&m,&s);
t=e+m+s;
a=t/3;
printf("Total=%.2f,Average=%.2f\n",t,a);
if(a<35)
printf("Fail");
else if(a<50)
printf("Pass Class");
else if(a<60)
printf("Second Class");
else if(a<70)
printf("First Class");
else
printf("Distinction");
}
No comments:
Post a Comment