nq1s788

перевод из 10 в x

Oct 1st, 2025
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.31 KB | None | 0 0
  1. #если основание до 10
  2. n = int(input())
  3. x = ''
  4. while n != 0:
  5.     x = str(n % 3) + x
  6.     n //= 3
  7. print(x)
  8.  
  9. #если больше 10
  10. n = int(input())
  11. x = ''
  12. while n != 0:
  13.     if n % 13 > 10:
  14.         x = 'ABC'[n % 13 - 10] + x
  15.     else:
  16.         x = str(n % 13) + x
  17.     n //= 13
  18. print(x)
Advertisement
Add Comment
Please, Sign In to add comment