Tuesday, 20 October 2015

C program to print the results of students

  • When the following conditions are given

                                       PERCENTAGE(%)                                                          DIVISION       

                                              >=60                                                                                 1st
                                        >=45 & <60                                                                           2nd
                                        >=30 & <45                                                                           3rd
                                               <30                                                                                  FAIL

                                                                                                                                                                                                                                       

#include<stdio.h>
#include<conio.h>
void main()
{
int math,phy,chem,hin,eng;
float total,percentage;
clrscr();
printf("\nenter marks of maths=");
scanf("%d",&math);
printf("\nenter marks of phy=");
scanf("%d",&phy);
printf("\nenter marks of chem=");
scanf("%d",&chem);
printf("\nenter marks of hindi=");
scanf("%d",&hin);
printf("\nenter marks of english=");
scanf("%d",&eng);
total=math+phy+chem+hin+eng;
printf("\ntotal=%f",total);
percentage=(total*100)/500;
printf("\npercentage=%f",percentage);
if(percentage<30)
{
printf("\n you are fail");
}
else if(percentage>=30&&percentage<45)
{
printf("\n you have secured 3rd division");
}
else if(percentage>=45&&percentage<60)
{
printf("\n you have secured 2nd division");
}
else if(percentage>=60)
{
printf("\n Congrats ! you have secured 1st division");
}
getch();
}

       

No comments:

Post a Comment