Numbers divisible by 3

Report a typo

You are given two integers a and b, where a ≤ b.

Write a program that finds and prints all numbers divisible by 3 between a and b (inclusive). Print each number divisible by 3 on its own line.

Notes:

  • At least one number divisible by 3 exists in the range;

  • Include both a and b in your calculations if they are divisible by 3.

Sample Input 1:

-5
12

Sample Output 1:

-3
0
3
6
9
12
Write a program in Python 3
a = int(input())
b = int(input())

Create a free account to access the full topic