Friday, April 10, 2015

4. The marks obtained by a student in 7 different subjects are entered through the keyboard.The students gets a division as per following rules:

percentage greater or equal to 80                                       First division

percentage between 45 and 79                                            Second division

percentage between 35 and 44                                            Third division

percentage less than 35                                                        Fail

Marks less than 35 in a subject will be declared as            Fail

Write a program to process result of all students based on the specification state above.


#include<stdio.h> 
#include<conio.h>
void main()
{
int m1,m2,m3,m4,m5,m6,m7,total;
float per;
clrscr();
printf("\n Input marks of 7 subjects:-");
scanf("%d%d%d%d%d%d%d",&m1&m2&m3&m4&m5&m6&m7);
total=m1+m2+m3+m4+m5+m6+m7;
printf("Total marks=%d",total);
if(m1>=35 && m2>=35&&m3>=35&&m4>=35&&m5>=35&&m6>=35&&m7>=35)
{
per=(float)total/7;
printf("\percentage = %8.2f",per);
if(per>=80)
  printf("\n Result: first division");
else if(per>=45)
 printf("\n Result: Second division");
else
  printf("\n result: Third division");
}
else
printf("\n Failed");
getch();
}

No comments:

Post a Comment