-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproblem_13.cpp
More file actions
40 lines (39 loc) · 929 Bytes
/
Copy pathproblem_13.cpp
File metadata and controls
40 lines (39 loc) · 929 Bytes
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
40
#include<iostream>
using namespace std;
int main(){
cout<<"Enter the number of 5 subjects"<<endl;
int mark1,mark2,mark3,mark4,mark5,to_mark,percentage;
cin>>mark1>>mark2>>mark3>>mark4>>mark5;
to_mark=mark1+mark2+mark3+mark4+mark5;
percentage=to_mark/5;
cout<<"Your percentage is-"<<percentage<<"%"<<endl;
int grade;
if(percentage>=90&&percentage<=100){
grade='A';
}
else if(percentage>=80&&percentage<90){
grade='B';
}
else if(percentage>=70&&percentage<80){
grade='C';
}
else{
grade='D';
}
switch(grade){
case 'A':
cout<<"Grade A";
break;
case 'B':
cout<<"Grade B";
break;
case 'C':
cout<<"Grade C";
break;
case 'D':
cout<<"fail...shame on you!";
break;
default:
cout<<"you enter wrong number please try again";
}
}