JavaScript Program to print even numbers between 1 to 100
In this program, you will learn how to print even numbers between 1 to 100 in JavaScript.
if(condition){
//statement
}
Example: How to print even numbers between 1 to 100 in JavaScript
for (let i = 1; i < 100; i++) {
if (i % 2 == 0) {
console.log("Number is even:" + i)
}
}
Output:
Number is even:2
Number is even:4
Number is even:6
Number is even:8
Number is even:10
Number is even:12
Number is even:14
Number is even:16
Number is even:18
Number is even:20
Number is even:22
Number is even:24
Number is even:26
Number is even:28
Number is even:30
Number is even:32
Number is even:34
Number is even:36
Number is even:38
Number is even:40
Number is even:42
Number is even:44
Number is even:46
Number is even:48
Number is even:50
Number is even:52
Number is even:54
Number is even:56
Number is even:58
Number is even:60
Number is even:62
Number is even:64
Number is even:66
Number is even:68
Number is even:70
Number is even:72
Number is even:74
Number is even:76
Number is even:78
Number is even:80
Number is even:82
Number is even:84
Number is even:86
Number is even:88
Number is even:90
Number is even:92
Number is even:94
Number is even:96
Number is even:98