Program to display numbers
In this section, you will learn how you can easily print numbers like : "0 to 50", "0 to 100", "0 to 500", "0 to 1000" and more. In this example, we print 0 to 50 number using javascript.
Let's try to create a simple program :
➤ Code : javascript program to print numbers;
<script>
//Enter your number here, as often as you want to print.
let number = 50;
for(let i = 0; i<=number; i++) {
console.log(i);
}
<script>
Output :
0
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
Comments