how to find even numbers?

I am trying to find even numbers from 0 to 100 but it is not working. even it not showing any error. can anyone help me to figure out?

<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <script>        
var x = 1;
        while (x <= 100) {
            if (x % 2 == 0) {
                console.log(x);
            } else {
                break;
            }
            x++;
        }
    </script>
</body>

</html>


Read more here: https://stackoverflow.com/questions/66276901/how-to-find-even-numbers

Content Attribution

This content was originally published by Anik Chakraborty at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: