-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathproblem8.js
153 lines (108 loc) · 5.68 KB
/
problem8.js
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
/* You and your friends Tom, Jane, Peter and John got their final exam results. Your total
score is 85, Tom’s total score is 66, Jane’s total score is 95, Peter’s total score is 56
and John’s total score is 40. The grading chart is
80 or above A grade
60 or above B grade
50 or above C grade
40 or above D grade
39 or less => F grade
Write a program to find your and your friends’ grades using if-else.
[View problem source 📤](https://drive.google.com/file/d/1bfxye7A1p-BBJCQCXaiUetl_qyS2Vc1E/view) */
var myResult = 85;
var tomsResult = 66;
var janesResult = 95;
var petersResult = 56;
var johnsResult = 40;
/* ---------------------------------------------------------------------------
Program for finding my and my friends’ grades using if-else.
-------------------------------------------------------------------------- */
/* -----------------------------
For my result
--------------------------------- */
if( myResult <= 39){
console.log("Sorry !! Shourav😞😥 you failed in the exam. You got " + myResult + " out of 100. So your Grad is 'F' ") ;
}
else if( 40 <= myResult && myResult < 50 ){
console.log("Congratulations Shourav🥳💐💐 !! you passed the exam. You got " + myResult + " out of 100. So your Grad is 'D' ") ;
}
else if( 50 <= myResult && myResult < 60 ){
console.log("Congratulations Shourav🥳💐💐 !! you passed the exam. You got " + myResult + " out of 100. So your Grad is 'C' ") ;
}
else if( 60 <= myResult && myResult < 80 ){
console.log("Congratulations Shourav🥳💐💐 !! you passed the exam. You got " + myResult + " out of 100. So your Grad is 'B' ") ;
}
else {
console.log("Congratulations Shourav, It's Awesome🥳💖💕 !! you are the Best. You got " + myResult + " out of 100. So your Grad is 'A' ") ;
}
/* -----------------------------
For Tom's Result
--------------------------------- */
if( tomsResult <= 39){
console.log("Sorry !! Tom😞😥 you failed in the exam. You got " + tomsResult + " out of 100. So your Grad is 'F' ") ;
}
else if( 40 <= tomsResult && tomsResult < 50 ){
console.log("Congratulations tom🥳💐💐 !! you passed the exam. You got " + tomsResult + " out of 100. So your Grad is 'D' ") ;
}
else if( 50 <= tomsResult && tomsResult < 60 ){
console.log("Congratulations Tom🥳💐💐 !! you passed the exam. You got " + tomsResult + " out of 100. So your Grad is 'C' ") ;
}
else if( 60 <= tomsResult && tomsResult < 80 ){
console.log("Congratulations Tom🥳💐💐 !! you passed the exam. You got " + tomsResult + " out of 100. So your Grad is 'B' ") ;
}
else {
console.log("Congratulations Tom, It's Awesome🥳💖💕 !! you are the Best. You got " + tomsResult + " out of 100. So your Grad is 'A' ") ;
}
/* -----------------------------
For Jane's Result
--------------------------------- */
if( janesResult <= 39){
console.log("Sorry !! Jane😞😥 you failed in the exam. You got " + janesResult + " out of 100. So your Grad is 'F' ") ;
}
else if( 40 <= janesResult && janesResult < 50 ){
console.log("Congratulations Jane🥳💐💐 !! you passed the exam. You got " + janesResult + " out of 100. So your Grad is 'D' ") ;
}
else if( 50 <= janesResult && janesResult < 60 ){
console.log("Congratulations Jane🥳💐💐 !! you passed the exam. You got " + janesResult + " out of 100. So your Grad is 'C' ") ;
}
else if( 60 <= janesResult && janesResult < 80 ){
console.log("Congratulations Jane🥳💐💐 !! you passed the exam. You got " + janesResult + " out of 100. So your Grad is 'B' ") ;
}
else {
console.log("Congratulations Jane, It's Awesome🥳💖💕 !! you are the Best. You got " + janesResult + " out of 100. So your Grad is 'A' ") ;
}
/* -----------------------------
For Peter's Result
--------------------------------- */
if( petersResult <= 39){
console.log("Sorry !! Peter😞😥 you failed in the exam. You got " + petersResult + " out of 100. So your Grad is 'F' ") ;
}
else if( 40 <= petersResult && petersResult < 50 ){
console.log("Congratulations Peter🥳💐💐 !! you passed the exam. You got " + petersResult + " out of 100. So your Grad is 'D' ") ;
}
else if( 50 <= petersResult && petersResult < 60 ){
console.log("Congratulations Peter🥳💐💐 !! you passed the exam. You got " + petersResult + " out of 100. So your Grad is 'C' ") ;
}
else if( 60 <= petersResult && petersResult < 80 ){
console.log("Congratulations Peter🥳💐💐 !! you passed the exam. You got " + petersResult + " out of 100. So your Grad is 'B' ") ;
}
else {
console.log("Congratulations Peter, It's Awesome🥳💖💕 !! you are the Best. You got " + petersResult + " out of 100. So your Grad is 'A' ") ;
}
/* -----------------------------
For John's Result
--------------------------------- */
if( johnsResult <= 39){
console.log("Sorry !! Johns😞😥 you failed in the exam. You got " + johnsResult + " out of 100. So your Grad is 'F' ") ;
}
else if( 40 <= johnsResult && johnsResult < 50 ){
console.log("Congratulations Johns🥳💐💐 !! you passed the exam. You got " + johnsResult + " out of 100. So your Grad is 'D' ") ;
}
else if( 50 <= johnsResult && johnsResult < 60 ){
console.log("Congratulations John🥳💐💐 !! you passed the exam. You got " + johnsResult + " out of 100. So your Grad is 'C' ") ;
}
else if( 60 <= johnsResult && johnsResult < 80 ){
console.log("Congratulations John🥳💐💐 !! you passed the exam. You got " + johnsResult + " out of 100. So your Grad is 'B' ") ;
}
else {
console.log("Congratulations John, It's Awesome🥳💖💕 !! you are the Best. You got " + johnsResult + " out of 100. So your Grad is 'A' ") ;
}