#program
def prime(n):
lis=[]
for i in range(n):
num=int(input("Enter the element"))
lis.append(num)
for k in range(len(lis)):
label=0
for j in range(2,lis[k],1):
if lis[k]%j==0:
label=1
break
if label==0:
print(lis[k])
#main program
n=int(input("Enter size of the list"))
print("The size of the list",n)
prime(n)
Example:
Enter size of the list4 The size of the list 4 Enter the element4 Enter the element7 Enter the element9 Enter the element17 7 17
No comments:
Post a Comment