Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Find Factors of a Number Using Function

def FindFact(n):
    for i in range(1, n+1):
        if n % i == 0:
            print(i, end=" ")
    print()

print("Enter a Number: ", end="")
try:
    num = int(input())
    print("
Factors of " +str(num)+ " are: ", end="")
    FindFact(num)
except ValueError:
    print("
Invalid Input!")
Source by softhunt.net #
 
PREVIOUS NEXT
Tagged: #Find #Factors #Number #Using #Function
ADD COMMENT
Topic
Name
8+7 =