Answers for "moran number python"

1

moran number python

def total (n):
    Sum=0
    while n>0:
        Sum+=n%10
        n//=10
    return Sum
def prime(n):
    k=2
    while k*k<=n and n%k!=0:
        k+=1
    return k*k>n
    if k*k>n:
        return True
    else:
        return False
def moran_num(n):
    dup = n
    _sum = total(n)
    if (n % _sum == 0):
        c = n // _sum
        if (prime(c)):
            print('Moran')
            return
    print("Non-Moran")
            
x=int(input('Enter a number:'))
moran_num(x)
Posted by: Guest on June-15-2021

Python Answers by Framework

Browse Popular Code Answers by Language