Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- x = int(input())
- L = 0; M = 0
- while x > 5:
- L = L + 1
- if M < (x % 10):
- M = x % 10
- x = x // 10
- print("%d\n%d" % (L, M))
- #при x == 600, L == 3
- # 607%10 == 7
- #L+=1
- #607%10 = 7 --> M == 7
- #x = 607//10 == 60
- #L+=1 == 2
- #60%10 == 0 < M (7) условие не выполняется, M не меняется
- #x = 60//10 == 6
- #L+=1 == 3
- #6%10 == 6 < M (7) условие не выполняется, M не меняется
- #x = 6//10 == 0
- #x>5 - не выполняется, цикл закончен
- #607 нужная цифра
Advertisement
Add Comment
Please, Sign In to add comment