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

Write the definition for a class called complex that has floating point data members for storing real and imaginary parts. The class has the following member functions: void set(float, float) to set the specified value in object void disp() to display complex number object complex sum(complex) to sum two complex numbers & return complex number 1. Write the definitions for each of the above member functions. 2. Write main function to create three complex number objects. Set the value in two objects and call sum() to calculate sum and assign it in third object. Display all complex numbers.