Python: Print Numbers Divisible by 3

You can use a looping structure (such as a for loop or a while loop) along with conditional statements to output numbers between 1 and 100 that are divisible by 3. The following is an example code using a for loop:

for i in range(1, 101):  # 从1到100循环遍历数字
    if i % 3 == 0:  # 判断是否能被3整除
        print(i)  # 输出满足条件的数字

This code will output all the numbers between 1 and 100 that are divisible by 3, the result is:

3
6
9
12
...
96
99
bannerAds