# To find all prime numbers within a given range.
import math
n1 = int(input("Enter lower limit of range : "))
n2 = int(input("Enter upper limit of range : "))
print("\n")
if n1==0:
n1+=1
if n1>0:
for i in range(n1,n2):
flag=0
sqr = math.sqrt(i)
for j in range(2,int(sqr)+1):
if j!=0:
if (i%j)==0.0:
flag=1
break
if flag==0:
print(i,end=",")
else:
print("Pleae enter positive limit: ")
input("\n\nPress Any Key to Closse.")
If you have a great ability of thinking, imagination and visualisation than you have to codes your thinking and visualisation.
Tuesday, 29 May 2018
To find all prime numbers within a given range using python programming.
Subscribe to:
Post Comments (Atom)
Featured post
WAP to print of digits of a entered number.
// WAP to print of digits of a entered number #include <iostream> #include<cstdlib> using namespace std; int main() { ...

Popular Posts
-
# To implement Queue using list queueList = [] def enQueue(ele='\0'): if ele!='\0': queueList.append(...
-
# Python Program To demonstrate inheritance. # Parent Class class parentCls: def __init__(self): print("Parent Cl...
-
#Python program to demonstrate constructors # declaration of class class myClass: def __init__(self,fName,lName): # Constructor...
No comments:
Post a Comment