Answer to Question #260217 in Python for anji

Question #260217

composite numbers in the range


you are given two integers m and n .write a program to print all the composite numbers between m and n, (including m and n)


1)inputs are 2 and 9


in the given example the composite numbers present in range of 2 and 9 are 4,6,8,9

the output is

4

6

8

9



2)inputs are 1 and 4

the output is

4

1
Expert's answer
2021-11-02T10:29:30-0400
m=int(input('Enter m: '))
n=int(input('Enter n: '))
for number in range(m,n+1):
    factor=0
    for i in range(1,number):
      if number%i==0:
        factor=i
    if factor>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

Hema
22.10.22, 08:17

I got the anwer what i wanted

Leave a comment

LATEST TUTORIALS
New on Blog