50.5k views
4 votes
Create a loop that will output all the multiples of 5 that are greater than zero and less than 60 (do not include 60). 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55 Create a loop that will output all the numbers less than 200 that are evenly divisible by both 2 and 7. 14 28 … Create a loop that will calculate the sum of the multiples of 8 that are between 100 and 500. Output the sum only. Create a loop that will output the sum of all odd numbers between 20 and 10

User JWCS
by
5.3k points

1 Answer

4 votes

Answer:

Step-by-step explanation:

Let's do this in python

(a) Between 5 and 60 and divisible by 5

for i in range(5, 60/5):

print(5*i)

(b) Less than 200 and divisible and 2 and 7

for i in range(1, int(200/14) + 1):

print(14*i)

(c)Sum of multiple of 8 that are between 100 and 500

sum_result = 0

for i in range(100, 500):

if i % 8 == 0:

sum_result += i

print(sum_result)

(d)sum of all odd numbers between 20 and 10

sum_odd = 0

for i in range(10, 20):

if i % 2 == 1:

sum_odd += i

print(sum_odd)

User Blablaenzo
by
5.3k points