Forezz

ДЗ 6 Н 3

Jul 16th, 2019
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.38 KB | None | 0 0
  1. def summ(x):
  2.     s = 0
  3.     for i in range(len(str((x)))):
  4.         s += x % 10
  5.         x = x // 10
  6.     return s
  7. x = int(input())
  8. c1 = x
  9. n1 = summ(x)
  10. x = int(input())
  11. c2 = x
  12. n2 = summ(x)
  13. if n1 > n2:
  14.     print ("Сумма цифр в числе", c1, " больше")
  15. elif n2 > n1:
  16.     print ("Сумма цифр в числе",c2,  "больше")
  17. else:
  18.     print("Сумма одинакова")
Advertisement
Add Comment
Please, Sign In to add comment