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

Popular Post

Create a base class called shape .Use this class to store two double type values that could be used to compute the area of figures, Derive two specific classes called triangle and rectangle from the base shape .Add to the base class, a member function get_data() to initialise base class data members and another member function display_area() to compute and display the area of figures. Make display_area () as a virtual function and redefine this function in the derived class to suit their requirements. Using these three classes, design a program that will accept dimensions of a triangle or a rectangle interactively and display the area. Area of rectangle = x*y Area of triangle = ½*x*y