Introduction to Programming using Python 1st Edition

Published by Pearson
ISBN 10: 0132747189
ISBN 13: 978-0-13274-718-9

Chapter 5 - Loops - Programming Exercises - Page 160: 5.12

Answer

120 150 180 210 240 270 300 330 360 390 420 450 480 510 540 570 600 630 660 690 720 750 780 810 840 870 900 930 960 990

Work Step by Step

$Statement:$ Write a program that displays,ten numbers per line, all the numbers from 100 to 1,000 that are divisible by 5 and 6. The numbers are separated by exactly one space. $Code:$ numberPerLine=10 count=0 for a in range(100,1000): $ $ $ $ $ $ $ $ if a%5==0 and a%6==0: $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ count=count+1 $ $ $ $ $ $ $ $ $ $ if count%numberPerLine==0: $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ print(a) $ $ $ $ $ $ $ $ $ $ $ $ else: $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ print(a, " ") $Output:$ 120 150 180 210 240 270 300 330 360 390 420 450 480 510 540 570 600 630 660 690 720 750 780 810 840 870 900 930 960 990
Update this answer!

You can help us out by revising, improving and updating this answer.

Update this answer

After you claim an answer you’ll have 24 hours to send in a draft. An editor will review the submission and either publish your submission or provide feedback.