Skip to content

Instantly share code, notes, and snippets.

@Flid
Created June 26, 2019 08:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Flid/d9ac7170c5b42d721e9661c148f311b5 to your computer and use it in GitHub Desktop.
Save Flid/d9ac7170c5b42d721e9661c148f311b5 to your computer and use it in GitHub Desktop.
for i in range(2, n/2):
if not n % 1:
flag = 1;
break
if n == 1:
print("1 is neither a prime nor a composite number.")
else:
if flag == 0:
print(f"{n} is a prime number.")
else:
print(f"{s} is not a prime number.")
for(i = 2; i <= n/2; ++i) {
if(n%i == 0) {
flag = 1;
break;
}
}
if (n == 1) {
printf("1 is neither a prime nor a composite number.");
}
else {
if (flag == 0)
printf("%d is a prime number.", n);
}
else {
printf("%d is not a prime number.", n);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment