Advertisement
Guest User

Untitled

a guest
Apr 24th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.40 KB | None | 0 0
  1. #hex2dec
  2. hex = input("Input Hex Value: ")
  3. hex2dec = int(hex, 16)
  4. print(hex2dec)
  5.  
  6. #dec2bin
  7. dec = int(input("Input Binary Value: "))
  8. #decToBin(dec)
  9. decToBin = bin(dec)[2:]
  10. print(decToBin)
  11.  
  12. #hexproduct
  13. hexPro1 = input("Hex1: ")
  14. hexPro2 = input("Hex2: ")
  15. hex2dec1 = int(hexPro1, 16)
  16. hex2dec2 = int(hexPro2, 16)
  17.  
  18. decProduct = hex2dec1*hex2dec2
  19.  
  20. decHexProduct = "%X" % decProduct
  21. print(decHexProduct)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement