22 lines
453 B
Python
22 lines
453 B
Python
# Q7
|
|
|
|
# Initiallize variables
|
|
count = 0
|
|
numbers_per_line = 10
|
|
numbers_in_row = 0
|
|
|
|
for num in range(1000, 3001):
|
|
if num % 2 == 0 and num % 3 == 0 and num % 5 == 0:
|
|
print(num, end=' ')
|
|
count += 1
|
|
numbers_in_row += 1
|
|
|
|
if numbers_in_row == numbers_per_line:
|
|
print()
|
|
numbers_in_row = 0
|
|
|
|
if numbers_in_row > 0:
|
|
print()
|
|
|
|
print(f"Total numbers that are divisible by 2, 3, and 5: {count}")
|