Computer Science, asked by Rajesha8860, 1 year ago

Write a program to calculate the grade of the student in a class of 60 students using structures.

Answers

Answered by Anonymous
10

Suppose we have 5 subjects.

Then the programm will be..

/* C Program - Calculate Grade of Student */

 

#include<stdio.h>

#include<conio.h>

void main()

{

clrscr();

int mark[5], i;

float sum=0,avg;

printf("Enter marks obtained in 5 subjects :");

for(i=0; i<5; i++)

{

 scanf("%d",&mark[i]);

 sum=sum+mark[i];

}

avg=sum/5;

printf("Your Grade is ");

if(avg>80)

{

 printf("A");

}

else if(avg>60 && avg<=80)

{

 printf("B");

}

else if(avg>40 && avg<=60)

{

 printf("C");

}

else

{

 printf("D");

}

getch();

}

Similar questions