Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Prime.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
def prime(n):
flag=0
print(2,3,end=" ")
for i in range(5,n+1):
for j in range(2,int(math.sqrt(i))+1):
for i in range(5,n+1,1):
for j in range(2,int(math.sqrt(i))+1): #using math sqrt function of math module
if i%j==0:
flag=0
break
Expand All @@ -18,8 +18,8 @@ def prime(n):
continue
if flag==1:
flag=0
print(i,end=" ") #prints
print(i,end=" ") #printing value of i whenever condition is true

n=int(input("Enter the number: "))
prime(n) #funtion called
n=int(input("Enter the number: ")) #inputing the number from the user
prime(n) # calling the prime function