write a python program to check whether a number is prime or not
Answers
Answered by
5
Answer:
- num = int(input("Enter a number: "))
- if num > 1:
- for i in range(2,num):
- if (num % i) == 0:
- print(num,"is not a prime number")
- print(i,"times",num//i,"is",num)
- break.
- else:
Answered by
16
n=int(input("Enter your number :"))
if n>1:
for i in range (2,n):
if n%i==0:
print(n,"is NOT a Prime Number.")
break
else:
print(n,"is a Prime Number.")
Similar questions
Computer Science,
26 days ago
Accountancy,
26 days ago
English,
26 days ago
Physics,
1 month ago
English,
8 months ago