How to calculate grade without else?

CODE




How to calculate grade without else
int main()
{
    float mark;
    printf("\n Enter the marks(out of 100):");
    scanf("%f",&mark);
    if(mark<=100 && mark>=95)
        printf("\n Grade:O");
    if(mark<95 && mark>=90)
        printf("\n Grade=A");
    if(mark<90 && mark>=85)
        printf("\n Grade=B");
    if(mark<85 && mark>=80)
        printf("\n Grade=C");
    if(mark<80)
        printf("\n Grade=D");
}


Output:
Enter the marks(out of 100):
94

 Grade=A

How to calculate grade without else? How to calculate grade without else? Reviewed by Unknown on December 15, 2018 Rating: 5

No comments:

If you have any doubt or query ,comment below:

Programming copyright © 2018-19. Powered by Blogger.