Skip to content
Advertisement

Why is the number 30 not displayed at the end of the output? [closed]

enter image description here

JavaScript

Advertisement

Answer

Add a print after the loop. You can also start with 2. And increment by 2 for each iteration (thus eliminating the need for the modulo two test). Something like,

JavaScript

Which outputs

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement