A number is even when the remainder after division by 2 is zero. The modulus operator % is the simplest test.
for(\21=1;\21<=20;\21++){
if(\21 % 2 ==0){
echo \21;
echo '<br>'; // Line break
}
}Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.