forked from Minskoleopc/javascript830B
-
Notifications
You must be signed in to change notification settings - Fork 0
/
script6.js
97 lines (74 loc) · 1.38 KB
/
script6.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
// one input and multiple outcomes
// numT > 0 && numT <= 5 -------> 10 % discount
// numT > 5 && numT <= 10 -------> 20 % discount
// numT > 10 -------> 30 % discount
let numT = 7
if(numT > 0 && numT <= 5){
console.log("10 % discount")
}
if(numT > 5 && numT <= 10){
console.log("20 % discount")
}
if(numT >10){
console.log("30 % discount")
}
// program 2
// let numT2 = -17
// if(numT2 > 0 && numT2 <= 5){
// console.log("10 % discount")
// }
// else if(numT2 > 5 && numT <= 10){
// console.log("20 % discount")
// }
// else if(numT2 > 10){
// console.log("30 % discount")
// }
// else {
// console.log("incorrect input")
// }
// program 3
let marks = 92
if(marks > 90){
console.log("Grade A")
}
if(marks >= 75){
console.log("Grade B")
}
if(marks >= 65){
console.log("Grade C")
}
let marksB = 50
if(marksB > 90){
console.log("Grade A")
}
else if(marksB >= 75){
console.log("Grade B")
}
else if(marksB >= 65){
console.log("Grade C")
}
else {
console.log("Please try again")
}
// program 5
let x = 10
let y = 15
if(x > y){
console.log("x is greater")
}
else {
console.log("y is greater")
}
// program 6
let x1 = 10
let x2 = 70
let x3 = 400
if(x1 > x2 && x1 > x3){
console.log("x1 is greater")
}
else if(x2 > x3 && x2 > x1){
console.log("x2 is greater")
}
else {
console.log("x3 is greater")
}