39.5k views
2 votes
4.3 Code Practice: Question 2 [Intructions shown]

Write a program that uses a while loop to calculate and print the multiples of 3 from 3 to 21. Your program should print each number on a separate line.

Expected Output
3
6
9
12
15
18
21

4.3 Code Practice: Question 2 [Intructions shown] Write a program that uses a while-example-1
User Hiroyukik
by
4.9k points

1 Answer

3 votes

Answer:

i = 3

while(i <= 21):

if (i % 3 == 0):

print(i)

i += 3

Step-by-step explanation:

User Ezze
by
6.1k points