Write a Python Program to Print all Prime Numbers in an Interval of 1-10.

Write a Python Program to Print all Prime Numbers in an Interval of 1-10.

Program
def myfun():
    lower=int(input("Enter lower number: "))
    upper=int(input("Enter upper number: "))
    print("Prime numbers between ",lower," and ",upper," are:")
    for num in range(lower,upper+1):
        if(num>1):
            for i in range(2,num):
                if(num%i==0):
                    break;
            else:
                print(num)
if __name__=="__main__":
    myfun()



Output:

Enter lower number: 1
Enter upper number: 10
Prime numbers between 1 and 10 are:
2
3
5
7



More Questions


66 . Write a Python Program to Check Prime Number.
67 . Write a Python Program to Print all Prime Numbers in an Interval of 1-10.
68 . Write a Python Program to Find the Factorial of a Number.
69 . Write a Python Program to Display the multiplication Table.
70 . Write a Python Program to Print the Fibonacci sequence.
71 . Write a Python Program to Check Armstrong Number?
72 . Write a Python Program to Find Armstrong Number in an Interval.
73 . Write a Python Program to Find the Sum of Natural Numbers.
74 . Write a Python Program to Find LCM.
75 . Write a Python Program to Find HCF.
76 . Write a Python Program to Convert Decimal to Binary, Octal and Hexadecimal.



For latest job updates join Telegram Channel: https://t.me/sateeshm