JavaScript code to display all even numbers between 1 to 100:
var n=1;// declared the variable and initialized it
for( n=1; n<=100; n++){
if(n%2==0){
console.log(n);
}
}
Output:
2
4
6
8
10
...upto
98
100
JavaScript code to display all even numbers between 1 to 100:
Output:
2
4
6
8
10
...upto
98
100
Comments
Post a Comment