Tuesday, 7 April 2020

Program: Print all prime number from 1 to 100

for i in range(1,100):
    flag=0
    for j in range(2,i//2+1):
        if i%j==0:
            flag=1
            break
    if flag==0:
        print(i)
       

No comments:

Post a Comment