BrainyBeauty1217 BrainyBeauty1217
  • 22-12-2020
  • Computers and Technology
contestada

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

Respuesta :

goodLizard
goodLizard goodLizard
  • 23-12-2020

Code:

num = 3

while num <= 21:

   print(num)

   num+=3

Output of code:

3

6

9

12

15

18

21

Explanation:

The condition num <= 21 will ensure that the program will only print multiples of 3 up to 21. We set num as 3 since we want to start printing from 3, and we add 3 each time to get the multiples.

Hope this helps :)

Answer Link

Otras preguntas

The neutral particles found in the nucleus of an atom are referred to as
pOH is a measure of the ________________ in solution. *
SOMEBODY PLS HELP ME NOW!!!!
I need help ImmediatelyAll of the following are examples of helping endangered species EXCEPT:A.habitat restoration which may include removing invasive speciesB
The Freedmen's Bureau closed in 1872 because it had been unable to found any schools in the South. African Americans were adjusted to freedom. it had achieved a
Choose the graph which displays the equation.y=5x+1​
Which executive department is responsible for managing public lands and nat the Department of State the Department of Justice the Department of Interior the Dep
For a school lunch menu they offer 12 combinations each day. Which of the following could describe the lunch options? Select all that apply. a. 6 kinds of pi
Proofread this extract and correct the four apostrophe-related errors sock it to your pocket
If you're good at trig please help meeeee Show full working out ;)