-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathloops_basic.js
More file actions
31 lines (16 loc) · 873 Bytes
/
Copy pathloops_basic.js
File metadata and controls
31 lines (16 loc) · 873 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
// 1- Write a program that prints numbers from 1 to 10 using a for loop.
for (let a=1;a<=10;a++){
console.log(a)
}
// 2-Write a program that prints the even numbers from 1 to 10 using a for loop.
for(a=0;a<11;a+=2){
console.log(a)
}
// 3- Write a program that prints the odd numbers from 1 to 10 using a while loop.
// 4- Write a program that prints the multiplication table of a number entered by the user using a for loop.
// 5- Write a program that calculates the sum of numbers from 1 to 100 using a while loop.
// 6- Write a program that calculates the factorial of a number entered by the user using a for loop.
// 7- Write a program that prints the Fibonacci series up to a certain number entered by the user using a while loop.
// 8- Write a program that prints the reverse of the following numbers:
//5 , 10 , 15 , 20
// using a while loop.