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

Two factors that can cause a person to change their status from *employed" to "not economically active" ​
Given the figure below, find the values of x and z. (10x - 71) (11x - 86) N
Karl marx coined the phrase ""survival of the fittest."" please select the best answer from the choices provided t f
During the classical period, the socio-political atmosphere in europe began to move?
Skills learned on the job or through training designed to increase your knowledge or expertise in a certain area are known as _____ skills.
The component of energy expenditure having the widest range of potential caloric value is?
Do the plates in a and b consist of continental lithosphere?
Louise nevelson made sculptures by arranging boxes, filled with discarded material called?
PLEASE HELP FOR BRAINLIEST!!!Answer questions 21 and 22.
Measures of student performance have not increased even though per-pupil government subsidies have increased because?