print("Enter the Number: ")
num = input()
num = int(num)
print("
Factors of", num)
i = 1
while i<=num:
if num%i==0:
print(i)
i = i+1
print("Enter a Number: ", end="")
try:
num = int(input())
print("
Factors of " +str(num)+ " are: ", end="")
i = 1
while i<=num:
if num % i == 0:
print(i, end=" ")
i = i + 1
print()
except ValueError:
print("
Invalid Input!")
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!")