Answer to Question #322620 in Python for lokesh

Question #322620

Composite Numbers in the range:


(1) Input: 2 Output: 4

9 6

8

9


(2) Input: 1 Output: 4

4


1
Expert's answer
2022-04-02T15:47:02-0400
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS