Have a Read!

Hi Everyone.
The idea for this page is to provide new c users simple c tutorials to learn how to develop the logic and more importantly correct way to write syntax.
ENJOY !!!

Thursday, January 27, 2011

C PROGRAM FOR GRADE CALCULATOR

#include<stdio.h>
int main () {
int sub1,sub2,sub3,sub4,sub5,total;
float average;
printf("ENTER THE NUMBERS IN 5 SUBJECTS OF THE STUDENT\n");
scanf("%d%d%d%d%d",&sub1,&sub2,&sub3,&sub4,&sub5);
   total=sub1+sub2+sub3+sub4+sub5;
   average=total/5;
   if(average>=80)
     {printf("STUDENT HAS GOT A GRADE\n");}
  else if(average>=70)
     {printf("STUDENT HAS GOT B GRADE\n");}
  else if(average >=60)
     {printf("STUDENT HAS GOT C GRADE\n");}
  else if(average>=50)
     {printf("STUDENT HAS GOT D GRADE\n");}
  else if(average>=40)
     {printf("STUDENT HAS GOT E GRADE\n");}
  else
     {printf("STUDENT HAS FOT F GRADE\n");}  
return 0;
}

No comments:

Post a Comment

Related Posts with Thumbnails