Program to accept grade and declare the equivalent description.

Here, we have a basic program example to print description given below on the user input grade using different languages. description for reference:

Grade Description

E     Excellent

V     Very Good

G     Good

A     Average

F     Fail

This program is created in c language, c++, Java, and Python.

Description for user input grade in C language

#include <stdio.h>
#include <ctype.h>
#include <string.h>

void main()
{
    char grd;

    printf("Input the grade :");
    scanf("%c", &grd);

    grd = toupper(grd);
    switch(grd)
    {
    case 'E':
        printf("Excellent");
        break;
    case 'V':
        printf("Very Good");
        break;
    case 'G':
        printf("Good");
        break;
    case 'A':
        printf("Average");
        break;
    case 'F':
        printf("Fails");
        break;
    default :
        printf("Invalid grade");
        break;
    }
}

Description for user input grade in C++ language

#include<iostream>
using namespace std;
int main()
{
    char grd;
    cout<<"Input the grade : ";
    cin>>grd;

    grd = toupper(grd);
    switch(grd)
    {
    case 'E':
        cout<<"Excellent";
        break;
    case 'V':
        cout<<"Very Good";
        break;
    case 'G':
        cout<<"Good";
        break;
    case 'A':
        cout<<"Average";
        break;
    case 'F':
        cout<<"Fails";
        break;
    default :
        cout<<"Invalid grade";
        break;
}
}

Description for user input grade in Python language

ch=input("Input the grade :  ")
if(ch=='a' or ch=='A'):
    print("Average")
elif(ch=='e' or ch<='E'):
    print("Excellent")
elif(ch=='v' or ch<='V'):
    print("very Good")
elif(ch=='g' or ch<='G'):
    print("Good")
elif(ch=='f' or ch<='F'):
    print("Fail")
else:
    print("Invalid grade")

Description for user input grade in Java language

import java.util.*;
public class grade {

    public static void main(String[] args) {

        char grd;

	   Scanner s=new Scanner(System.in);
	   System.out.println("Input the grade : ");
	   grd = s.next().charAt(0);

             grd = Character.toUpperCase(grd);
	    switch(grd)
	    {
	    case 'E':
		System.out.println("Excellent");
		break;
	    case 'V':
		System.out.println("Very Good");
		break;
	    case 'G':
		System.out.println("Good");
		break;
	    case 'A':
		System.out.println("Average");
		break;
	    case 'F':
		System.out.println("Fails");
		break;
	    default :
		System.out.println("Invalid grade");
		break;
	}
    }
}