You can give a recursive solution to this, but I just went with a while loop and checked all odds
Anonymous
Jul 21, 2020
In python:
number = input("enter a number to check if it is prime: ")
intNumber = int(number)
Output = "Congrats you have a prime number"
for n in range(2, 9):
if (intNumber % n == 0) & (intNumber != n):
Output = "Not a Prime number"
print(Output)