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
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)
Comments
I got the anwer what i wanted
Leave a comment