About Me

My photo
gandhinagar, gujarat, India
hi.. friends i'am student of kv crpf gandhinagar..and i would like to spread my view and thinking on computer..this blog is for not only those who wants to get knowledge.

Wednesday 11 May 2011

To know the grade and to know the student is pass or fail...


#include
#include
void main()
{
int a,b,c,d,total,per;
clrscr();
printf("enter the marks in 5 subject:\n");
printf("\nmaths=");
scanf("%d",&a);
printf("\nscience=");
scanf("%d",&b);
printf("\njava=");
printf("\nc++=");
scanf("%d",&c);
printf("\nasp.net=");
scanf("%d",&d);
total=a+b+c+d;
per=total/4;
printf("\ntotal=%d",total);
printf("\npercentage=%d",per);
if(per>=90)
{
printf("\n A grade");
}
else if(per>80)
{
printf("\n B grade");
}
else if(per>70)
{
printf("\n C grade");
}
else if (per>60)
{
printf("\n D grade");
}
else if (per>50)
{
printf("\n E grade");
}
if(per>=40)
{
printf("\npass class");
}
else if(per<=40)
{
printf("\n fail");
}
getch();
}

0 comments:

Post a Comment