C Program to write Student MarksList Logic using ‘if’ statement.
How does this program work?
- This code helps to how to write Student MarksList program using ‘if’ statement.
Here is the code
main (void)
{
int t,e,h,m,sc,so,tot;
float avg;
printf("Enter Telugu Marks:\n");
scanf("%d",&t);
printf("Enter English Marks:\n");
scanf("%d",&e);
printf("Enter Hindi Marks:\n");
scanf("%d",&h);
printf("Enter Maths Marks:\n");
scanf("%d",&m);
printf("Enter Science Marks:\n");
scanf("%d",&sc);
printf("Enter Social Marks:\n");
scanf("%d",&so);
tot=t+e+h+m+sc+so;
avg=tot/6;
printf("Total=%d\n", tot);
printf("average=%f\n",avg);
if(t<35||e<35||h<35||m<35||sc<35||so<35)
{
printf("fail");
}
else if(avg>=35&&avg<50)
{
printf("IIIrd class");
}
else if(avg>=50&&avg<60)
{
printf("IInd class");
}
else if(avg>=60&&avg<75)
{
printf("Ist class");
}
else
{
printf("Distinction");
}
}