0 votes
in Computer by (50 points)

def isPrime(N)
    for i in N:
        if N%i==0:
           return 0

return 1

NUM=int(input("Enter a natural number N:"))

if isPrime(NUM)==1:
    print(NUM+"is a Prime number")
else if:
    print(NUM+"is NOT a Prime number")

Please log in or register to answer this question.

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.