-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproblems.js
58 lines (47 loc) · 1.44 KB
/
problems.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
/**
* Press the lightening bolt symbol to launch your program, then open the javascript console
* To see the result of your code! You can use Ctrl-Shift-j to open the console.
*/
/**
* Write converter that converts liras to dollars,
* Where there are two lira to each dollar.
*/
function lirasToDollars (lira) {
// Write your code here!
}
console.log("5 lira in us dollars is "+lirasToDollars(5));
/**
* Write a function that says Merhaba to the name passed in
* For example, "Merhaba, Chris!"
*/
function merhaba (adim) {
// Write your code here!!!
}
merhaba();
/**
* Write a function that returns the minimum of the two
* inputs
*/
function min (a, b) {
// Write your code here!!!
}
console.log("The mininimum of 5 and 2 is "+min(5,2));
console.log("The minimum of kedi and köpek is "+min("kedi", "köpek"));
/**
* Return the sum of the numbers from 1 up to (and including) n
* For example, sum(3) = 1+2+3 = 6
*/
function sum (n) {
// Write your code here!!!
}
console.log("The sum of 1 through 3 is "+sum(3));
console.log("The sum of 1 through 5 is "+sum(5));
/**
* Limited sum, calcualte the sum of 1 to n but only use multiples of 3 in the sum!
* For example, sumMultiplesOf3(6) = 3+6 = 9!
*/
function sumMultiplesOf3 (n) {
// Write your code here!
}
console.log("The sum of 1 to 6 with only multiple of 3 is "+sumMultiplesOf3(6));
console.log("The sum of 1 to 12 with only multiple of 3 is "+sumMultiplesOf3(12));