Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prime.py #116

Open
Sonali1554 opened this issue Oct 17, 2024 · 3 comments
Open

prime.py #116

Sonali1554 opened this issue Oct 17, 2024 · 3 comments

Comments

@Sonali1554
Copy link

num = 11

Negative numbers, 0 and 1 are not primes

if num > 1:

# Iterate from 2 to n // 2
for i in range(2, (num//2)+1):
  
    # If num is divisible by any number between
    # 2 and n / 2, it is not prime
    if (num % i) == 0:
        print(num, "is not a prime number")
        break
else:
    print(num, "is a prime number")

else:
print(num, "is not a prime number")

@nevil2006
Copy link

prime.zip

@namanhere23
Copy link

Please assign me

@MohdAazam1
Copy link

/assign

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants