177k views
0 votes
Write a python program that should determine from the range you choose to enter :

The count of even and odd numbers

values divisible by 3

values divisible by 5​

1 Answer

3 votes

Answer:

I'm not fully sure if this will work, however, I'm 92% sure it is correct.

Step-by-step explanation:

startingrange = int(input("Enter a number for the starting of the range: "))

endingrange = int(input("Enter a number for the ending of the range: "))

divisiblebythree = 0

divisiblebyfive = 0

even = 0

odd = 0

for i in range(startingrange, endingrange):

if (i % 2) == 0:

even += 1

elif (i % 2) != 0:

odd += 1

if (i % 3) == 0:

divisiblebythree+=1

if (i%5) == 0:

divisiblebyfive+=1

print("Numbers divisible by 5:",divisiblebyfive)

print("Numbers divisible by 3:",divisiblebythree)

print("Odd numbers:",odd)

print("Even numbers:",even)

User Glennys
by
2.6k points