File tree 2 files changed +62
-0
lines changed
2 files changed +62
-0
lines changed Original file line number Diff line number Diff line change
1
+ ## Can you find out who will get the delicious cake?
2
+ ### (Part II)
3
+ This year, not only Jim & Dela but also Chinku are doing hard work to secure the first position. Can you find out who will get the delicious cake?
4
+
5
+ ** Input: The input line has three values, x (The marks Jim has got), y (The marks Dela has got) and z (The marks Chinku has got)**
6
+
7
+ ** Output: Print the name of the topper.**
8
+
9
+ 1 . Sample Input-1: 84 99 77
10
+ - Sample Output-1: Dea
11
+
12
+ 2 . Sample Input-2: 69 97 99
13
+ - Sample Output-2: Chinku
Original file line number Diff line number Diff line change
1
+ /* Can you find out who will get the delicious cake?
2
+ (Part II)
3
+ This year, not only Jim & Dela but also Chinku are doing hard work to secure the first position. Can you find out who will get the delicious cake?
4
+
5
+ **Input: The input line has three values, x (The marks Jim has got), y (The marks Dela has got) and z (The marks Chinku has got)**
6
+
7
+ **Output: Print the name of the topper.**
8
+
9
+ 1. Sample Input-1: 84 99 77
10
+ - Sample Output-1: Dela
11
+
12
+ 2. Sample Input-2: 69 97 99
13
+ - Sample Output-2: Chinku */
14
+
15
+
16
+
17
+ function findingTopper ( x , y , z ) {
18
+ if ( ( typeof x === "number" ) && ( typeof y === "number" ) && ( typeof y === "number" ) ) {
19
+ if ( x > y && x > z ) {
20
+ const cakeWinner = "Jim" ;
21
+ return cakeWinner ;
22
+ }
23
+
24
+ else if ( y > x && y > z ) {
25
+ const cakeWinner = "Dela" ;
26
+ return cakeWinner ;
27
+ }
28
+
29
+ else {
30
+ const cakeWinner = "Chinku" ;
31
+ return cakeWinner ;
32
+ }
33
+
34
+ }
35
+
36
+ else {
37
+ const errorMassage = "Please inter number value (marks)" ;
38
+ return errorMassage ;
39
+ }
40
+
41
+ } ;
42
+
43
+
44
+ const jimsMarks = 69 ;
45
+ const delasMarks = 97 ;
46
+ const chinkusMarks = 99 ;
47
+
48
+ const theCakeWillGet = findingTopper ( jimsMarks , delasMarks , chinkusMarks ) ;
49
+ console . log ( theCakeWillGet ) ;
You can’t perform that action at this time.
0 commit comments