-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path17_percentagegrade.cpp
More file actions
51 lines (47 loc) · 1021 Bytes
/
17_percentagegrade.cpp
File metadata and controls
51 lines (47 loc) · 1021 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
41
42
43
44
45
46
47
48
49
50
51
#include <iostream>
using namespace std;
int main()
{
int a, b, c, d, e = 0;
cout << " Enter your physics marks : ";
cin >> a;
cout << " Enter your chemistry marks : ";
cin >> b;
cout << " Enter your biology marks : ";
cin >> c;
cout << " Enter your mathematics marks : ";
cin >> d;
cout << " Enter your computer marks : ";
cin >> e;
int perc = (a + b + c + d + e) / 5;
cout << "You scored " << perc << "%" << endl;
if (perc >= 90 && perc < 100)
{
cout << "Grade A\n\n";
}
else if (perc >= 80 && perc < 90)
{
cout << "Grade B\n\n";
}
else if (perc >= 70 && perc < 80)
{
cout << "Grade C\n\n";
}
else if (perc >= 60 && perc < 70)
{
cout << "Grade D\n\n";
}
else if (perc >= 40 && perc < 60)
{
cout << "Grade E\n\n";
}
else if (perc >= 0 and perc < 40)
{
cout << "Grade F\n\n";
}
else
{
cout << "False input";
}
return 0;
}