PYTHON CHALLENGE
MAKE A PROGRAM TO CHECK WETHER A NUMBER IS PRIME OR NOT..
DON'T COPY FROM GOOGLE
DO IT YOURSELF
I WILL CHECK WETHER THE QUESTION IS COPIED OR DONE BY U
:):):):)
Anonymous:
GO AND CRACK IT
Answers
Answered by
1
Answer:
# FUNCTION TO CHECK WHETHER THE GIVEN NUMBER IS PRIME OR NOT
def prime(n):
for i in range(2,n):
if n%i==0:
print("not a prime")
break
else:
print("prime")
break
#MAIN
a=int(input("enter the number"))
prime(a)
(or)
#program to find whether the number is prime or not
n=int(input("enter the number"))
i=2
while i<=n-1:
if n%i==0:
print("composite")
break
i+=1
else:
print("prime")
#here is your answer
please mark brainliest
Similar questions
Social Sciences,
5 months ago
Science,
5 months ago
History,
5 months ago
English,
10 months ago
English,
10 months ago
Psychology,
1 year ago