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




Expert's answer

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!

LATEST TUTORIALS
APPROVED BY CLIENTS