Python Program to Print All Prime Numbers in an Interval Using For Loop
In this Program We Learn How to Print All Prime Numbers in an Interval Using For Loop in Python
Output
Java Program Code
Java Program to Print All Prime Numbers in an Interval
Example : Code Program
l = int(input("Enter Strating Range:"))
h = int(input("Enter Ending Range:"))
print("Prime number ",l," to ", h, " are")
for n in range(l, h+1):
if n>1:
for i in range(2, n):
if (n%i) == 0:
break
else:
print(n, end=" ")
h = int(input("Enter Ending Range:"))
print("Prime number ",l," to ", h, " are")
for n in range(l, h+1):
if n>1:
for i in range(2, n):
if (n%i) == 0:
break
else:
print(n, end=" ")
Output
Java Program Code
Java Program to Print All Prime Numbers in an Interval
Post a Comment