Answers for "Find Factors of a Number Using for Loop"

0

Find Factors of a Number Using for Loop

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

    print("\nFactors of " +str(num)+ " are: ", end="")
    for i in range(1, num+1):
        if num % i == 0:
            print(i, end=" ")
    print()
except ValueError:
    print("\nInvalid Input!")
Posted by: Guest on April-10-2022

Code answers related to "Find Factors of a Number Using for Loop"

Python Answers by Framework

Browse Popular Code Answers by Language