fork download
  1. t=int(input())#test cases
  2. for i in range (0,t):
  3. n=int(input())#decimal no
  4. x=0
  5. while n > 0:
  6. remain=n%16
  7. if remain < 10:
  8. x=x*1000+48+remain
  9. else:
  10. x=x*1000+65+(remain%10)
  11. n=n//16
  12. while x>0:
  13. k=x%1000
  14. print(chr(k),end='')
  15. x=x//1000
  16. print()
Success #stdin #stdout 0.01s 9992KB
stdin
2
255
64
stdout
FF
40