Program to calculate grade based on marks in C

#include <stdio. h>
int main( )
{ 
int m1,m2, m3, Total;
  char Grade;
printf("Enter three marks: \n") ;
   scanf( "%d%d%d", &m1, &m2,&m3) ;
  Total=m1+m2+m3;
if( m1<=40 || m2<=40 || m3<=40)
   { 
Grade='F' ;
   }
if( m1<=60 && m2<=60 && m3<=60 && Total>120)
   { 
Grade='C' ;
   }
if( m1<=80 && m2<=80 && m3<=80 && Total>180)
   { 
Grade='B' ;
   }
if( Total > 240)
   {
  Grade='A' ;
   }
printf("\nm1=%d, m2=%d, m3=%d. \n", m1, m2,m3) ;
printf("\nTotal=%d,Grade is %c.\n", Total, Grade) ;
return 0;
}

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.