Advertisement
CR7CR7

croocked digit

Sep 24th, 2022
854
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.18 KB | None | 0 0
  1. n = input()
  2. while True:
  3.     result = 0
  4.     for digit in str(n):
  5.         if digit.isalnum():
  6.             result += int(digit)
  7.     n = result
  8.     if n <= 9:
  9.         break
  10.  
  11. print(n)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement