Nested IF_2


// Nested IF

#include<stdio.h>
#include<conio.h>
void main()
{
 int m1,m2,m3,m4,m5,total;
 float per;
 printf("Enter marks of five subjects:\n");
 scanf("%d%d%d%d%d",&m1,&m2,&m3,&m4,&m5);

 total=m1+m2+m3+m4+m5;
 per=(float)total*100/500;  //to conver per variable into float so use float before calculation

 printf("Percentage is: %f\n",per);

 if(per>=60)
 {
  printf("First Division");
 }
 else if(per>=50 && per<60)
 {
  printf("Second Division");
 }
 else if(per>=40 && per<50)
 {
  printf("Third Division");
 }
 else
 {
   printf("Fail");

 }
getch();
}

Post a Comment

Previous Post Next Post