Write a program in C to accept a grade and declare the equivalent description.



QUESTION:-  Write a program in C to accept a grade and declare the equivalent description   

Grade Description 

E Excellent 

V Very Good 

G Good 

An Average 

F Fail 

 

#include <stdio.h>

#include <conio.h>

void main()

{

    char a;

    printf("enter a character(E, V, G, A, F): ");

    scanf("%c", &a);

    switch (a)

    {

    case 'E':

        printf("\nExcellent!");

        break;

    case 'V':

        printf("\nVery Good!");

        break;

    case 'G':

        printf("\nGood!");

        break;

    case 'A':

        printf("\nAverage!");

        break;

    case 'F':

        printf("\nFail!");

        break;

    default:

        printf("enter your correct grade!");
    }

    getch();
}

 

OUTPUT

Enter a character(E, V, G, A, F):  E

Excellent!


Follow our page for regular updates.

0 Comments