Computer Science, asked by kumarsanjay123, 4 days ago

WAP to print the first 20 even numbers​

Answers

Answered by darshiltilva
0

Answer:

Here is the

Option 1:

for number = 1 to 20:  

   if the number is even:  

       print the number  

Option 2:

for number = 2 to 20 step 2:  

   print the number

Explanation:

Most programming languages have a “step” option, or some equivalent, in their for statements.

To check whether a number is even, you typically ask whether number % 2 = 0. “%” is the modulus operator, i.e., it tells you the remainder of a division.

Similar questions