Raslboyy

Untitled

May 21st, 2021
768
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.28 KB | None | 0 0
  1. import math
  2.  
  3.  
  4. def dec_to_7(b: int):
  5.     a = int(math.fabs(b))
  6.     ans = ''
  7.     while a > 0:
  8.         ans = str(a % 7) + ans
  9.         a //= 7
  10.     if b > 0:
  11.         return ans
  12.     elif b < 0:
  13.         return "-" + ans
  14.     return 0
  15.  
  16.  
  17. a = int(input())
  18.  
  19. print(dec_to_7(a))
  20.  
Advertisement
Add Comment
Please, Sign In to add comment