Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Find Factors of a Number Using for Loop

print("Enter a Number: ", end="")
try:
    num = int(input())

    print("
Factors of " +str(num)+ " are: ", end="")
    for i in range(1, num+1):
        if num % i == 0:
            print(i, end=" ")
    print()
except ValueError:
    print("
Invalid Input!")
Source by softhunt.net #
 
PREVIOUS NEXT
Tagged: #Find #Factors #Number #Using #Loop
ADD COMMENT
Topic
Name
5+8 =