/*to calculate total and percentage along with division*/
#include<stdio.h>
#include<stdlib.h>
int main( )
{
int s1,s2,s3,s4,s5,tot;
float per;
printf ("enter the marks of 5 subjects: ");
scanf ("%d%d%d%d%d",&s1,&s2,&s3,&s4,&s5);
tot=s1+s2+s3+s4+s5;
per=tot/500.0*100;
printf ("total=%d",tot);
printf ("\npercentage=%f",per);
if (s1>=40&&s2>=40&&s3>=40&&s4>=40&&s5>=40)
{
if (per>=80)
printf ("\ndistinction");
else if (per>=60)
printf ("\nfirst division");
else if (per>=45)
printf ("\nsecond division");
else
printf ("\nthird division");
}
else
printf ("\nfail");
system ("pause");
return 0;
}
No comments:
Post a Comment