def print_factors(x): 
      """This function takes a
      number and prints the factors"""

      print("The factors of",x,"are:")
      for i in range(1, x + 1):
              if x % i == 0:
                      print(i)
num = int("320")

print_factors(num)
Вывод результата
Enter a number: 320 
The factors of 320 are:
1
2
4
5
8
10
16
20
32
40
64
80
160
320

Оценка - 1.0 (14)

 Похожие публикации
2015-11-29 • Просмотров [ 11866 ]