Print the grade for input test marks with the help of following table:



Print the grade for input test marks with the help of following table (nested if) 

*marks>100 error out of range 
*marks>=90 A 
*marks>=70 B 
*marks>=50 C 
*marks>=40 D 
*else Fail

C++ (TurboC)
#include<iostream.h>
#include<conio.h>

void main()
{
        clrscr();
        int marks;
        cout<<”Enter the Marks :”;
        cin>>marks;
    if(marks>100)
        cout<<”Error out of range :”;
    else if( marks>=90)
        cout<<” Grade is A :”;
    else if(marks>=70)
        cout<<” Grade is B :”;
    else if (marks>=50)
        cout<<” Grade is C :”;
    else if (marks>=40)
        cout<<” Grade is D:”;
    else cout<<” No Grade ! result is Fail :”;

    getch();
}

Post a Comment

0 Comments