Monday, June 3, 2019

Write a program to find the grade of the student


/* ***********************************************
    Write a program to find the grade of the student
    of the 4 subjects

 date:03-06-2019
 created by:ANIL DURGAM


 program details
 per>=85                        Grade =A
 per>70 && below per <85        Grade=B
 per>55 && beloW per<=70        Grade=C
 per>=40 && beloW per<=55       Grade=D
 per<40                         Grade=E

*****************************************************/

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int m1,m2,m3,m4,total,percent;
    char Grade;
    printf("please enter the marks of four subjects\n");
    scanf("%d%d%d%d",&m1,&m2,&m3,&m4);
    //printf("m1=%d,m2=%d,m3=%d,m4=%d\n",m1,m2,m3,m4);
    total=(m1+m2+m3+m4)/4;
    if(total>=85)
        Grade='A';
    else if(total<85 && total>=70)
        Grade='B';
    else if(total<70 && total>=55)
        Grade='C';
    else if(total<55 && total>=40)
        Grade='D';
    else if(total<40)
        Grade='E';


    printf("avg=%d\nGrade==%c\n",total,Grade);
    return 0;
}



No comments:

Post a Comment

python class topic video