The marks obtained by a student in 5 different subjects are input through the keyboard. The student gets a division as per the following rules: • Percentage above or equal to 60 - First Division • Percentage between 50 and 59 - Second Division • Percentage between 40 and 49 – Third Division • Percentage less than 40- Fail



#include<stdio.h>
#include<conio.h>
 main()
 float per,sum,s1,s2,s3,s4,s5;
   clrscr ();

   printf("enter your marks : ");
   scanf("%f%f%f%f%f",&s1,&s2,&s3,&s4,&s5);

   sum=s1+s2+s3+s4+s5;
   per=sum/5;

   printf("your percent is %f",per);

   if (per >= 60)
printf("\n first division");

   else if ( (per >= 50) && (per <=59) )
   printf("\n second division");

   else if ( (per >= 49) && (per <= 40 ) )
   printf("\n third division");

   else if (per < 40 )
   printf("\n fail");

getch ();  

}

output :
enter your marks : 50 50 50 50 50 your percent is 50.000000 second division



Comments