-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
35 lines (31 loc) · 775 Bytes
/
script.js
File metadata and controls
35 lines (31 loc) · 775 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
//Prints odds 1-20
console.log("The odd numbers 1-20 are: ")
for (let i = 1; i < 21; i++) {
if (i % 2 == 1) {
console.log(i)}
}
//Decreasing Multiples of 3
console.log("The numbers less than 100 that are divisible by 3 are: ")
for (let i = 100; i > 0; i--) {
if (i % 3 == 0) {
console.log(i)}
}
//Decreasing Multiples of 3
console.log("The printed numbers in the sequence are as follows: ")
for(let i = 4; i >- 4; i -= 1.5) {
console.log(i);
}
//Sigma
console.log("The answers for sigma are: ")
sum = 0;
for (let i = 1; i < 101; i++) {
sum = i + sum;
console.log(sum)
}
//Factorial
console.log("The answers for factorial are: ")
product = 1;
for (let i = 1; i < 13; i++) {
product = i * product;
console.log(product)
}