Grade Program using If Else – C++ Excercise
Flowchart of Grade Program using If Else
Let us see the Flowchart of Grade Program using If Else.
Code of Student Grade Finding using If Else
Let us see the Grade Program using If Else statement in C++.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
#include <iostream> using namespace std; int main() { int q,m,f,avg; cout<<"Enter quiz Marks out of 100:"; cin>>q; cout<<"Enter your Mid-term Marks out of 100:"; cin>>m; cout<<"Enter your Final Marks out of 100:"; cin>>f; avg=(q+m+f)/3; cout<<"your Average:"<<avg<<endl; switch(avg>=90) { case 1: cout<<"Congrates you got grade A Grade"; break; case 0: switch(avg>=70&&avg<90) { case 1: cout<<"you got grade B Grade"; break; case 0: switch(avg>=50&&avg<70) { case 1: cout<<"you got grade C Grade"; break; case 0: cout<<"sorry you got F Grade"; break; } break; } break; } } |
Output
Testing of the program (Explained)