Advertisement
ekzolot

Untitled

Dec 27th, 2022
894
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.59 KB | None | 0 0
  1. x = int(input())
  2. counto = 0
  3. counttw = 1
  4. countth = 0
  5. #Количество четных чисел
  6. a=x
  7. while a != 0:
  8.     if a % 2 == 0:
  9.         counto += 1
  10.     a = a // 10
  11. #Сколько раз встречается последняя цифра?
  12. a=x
  13. a = a // 10
  14. while a != 0:
  15.     if x%10 == a%10:
  16.         counttw += 1
  17.     a = a // 10
  18. #Сколько раз встречаются цифры 4 и 5 (суммарно)
  19. a=x
  20. while a != 0:
  21.     b = a % 10
  22.     if (b == 4) or (b == 5):
  23.         countth += 1
  24.     a = a // 10
  25. #Итоговый print
  26. print(counto, counttw, countth)
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement