Write a program to display the grade of students

//this is a program to display the grade of students
#include<stdio.h>
#include<conio.h>
void main()
{
int m1,m2,m3,sum;
float avg;

printf("\n\nEnter The marks of 3 subjects: ");
scanf("%d%d%d",&m1,&m2,&m3);

sum=m1+m2+m3;
avg=sum/3.0;

printf("\n\n Sum=%d Average=%f",sum,avg);

if(avg>=80)
printf("\n\nGrade A");
else if(avg>=60)
printf("\n\nGrade B");
    else if(avg>=40)
    printf("\n\nGrade c");
    else
    printf("\n\nfail");
    getch();
   
}

Previous
Next Post »