Basic Programs

If Else based Programs

Loop Based Programs

Array Based Programs

String Programs

Function Programs

Pointers Programs

Structure & File Handling Programs

Data Structure Programs

If Else based Programs

C Program to grade based on 5 subjects given marks

   Program to calculate the grade sheet of a student entered in five subject marks.

    1. find the total marks of the student.

    2. percentage of the student marks.

   3.  Check if student is pass or fail 

       Student is fail if marks in any subject is less than 50.

   4   Calculate the Grade of the student marks based on following criteria.

       a)percantage is between 50 and below 60 then C grade

      b)Percentage is between 60 and below  70 then B grade

      c) Percentage is equal or greater than 70 then A grade.

 

#include<stdio.h>
#include<conio.h>
int main() { int hindi=0,english=0,maths=0,science=0,computer=0,total;
float per=0;
printf("enter 5 subjects marks");
scanf("%d%d%d%d%d",&hindi,&english,&maths,&science,&computer);
total=hindi+english+maths+science+computer;
per=total/5;
if(hindi<50 || english<50 || maths<50 || science<50 || computer<50)
printf("student fail with total marks %d",total);
else
{
if(per>=50 && per <60)
printf("C Grade total marks %d percentage=%f",total,per);
if(per>=60 && per<70)
printf("B Grade total marks=%d percentage=%f",total,per);
if(per>=70)
printf("A Grade total marks=%d percentage=%f",total,per);
}
}

Output of the above program is as following.

Video/ C Introduction

Watch video in full size
Wordpress Social Share Plugin powered by Ultimatelysocial