8 Antworten
+ 4
#Even numbers from 0 to 100
i = 0
while i<=100:
print(i)
i += 2
+ 3
You can use modulo division operator for check if a number is even. Try to do that in an attempt on Sololearn Playground and link with your question.
+ 1
First, you'll have to see how till how many you want to print. So for eg. Even numbers till 10 will be like this
i = 1
# Run a loop 10 times
while i <= 10:
# Check if i is an even number. if yes, then print it
if i % 2 == 0:
print(i)
i += 1
+ 1
Thank you
0
i = 0
while i <= 100:
print(i := i +2)
0
Or,
i = 0
while i <= 100:
print(i := i +2)
0
#even numbers 0 to 100
i = 0
While I<=100:
Print (i)
i+=2
- 1
You can use modulo division operator for check if a number is even. Try to do that in an attempt on Sololearn Playground and link with your question.