Answer to Question #298763 in Python for Sai

Question #298763

Given two integers M, N as input. Write a program to print all the composite numbers present in the given range (including M and N)



Input:



2



9




1
Expert's answer
2022-02-16T17:40:04-0500
M = int(input())
N = int(input())

print("\nComposite numbers between M and N include")
for num in range(M,N+1):
    count = 0
    for diviser in range(2,num//2+1):
        if num % diviser == 0:
            count+=1
    if count >= 1:
        print(num)

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