JavaScript code to display all odd 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:
1
3
5
7
....up to
99
JavaScript code to display all odd numbers between 1 to 100:
Output:
1
3
5
7
....up to
99
Comments
Post a Comment