{"id":19219,"date":"2021-08-30T16:06:25","date_gmt":"2021-08-30T10:36:25","guid":{"rendered":"https:\/\/python-programs.com\/?p=19219"},"modified":"2021-11-22T18:36:30","modified_gmt":"2021-11-22T13:06:30","slug":"python-program-to-convert-decimal-to-hexadecimal","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-to-convert-decimal-to-hexadecimal\/","title":{"rendered":"Python Program to Convert Decimal to Hexadecimal"},"content":{"rendered":"

In the previous article, we have discussed Python Program to Convert Hexadecimal To Octal<\/a>
\nGiven a decimal number and the task is to get the respective hexadecimal number using the while loop.<\/p>\n

Examples:<\/strong><\/p>\n

Example1:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given decimal number = 30<\/pre>\n

Output:<\/strong><\/p>\n

The Hexadecimal value of the given decimal number { 30 } is: \r\n1E<\/pre>\n

Example2:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given decimal number = 60<\/pre>\n

Output:<\/strong><\/p>\n

The Hexadecimal value of the given decimal number { 60 } is: \r\n3C<\/pre>\n

Program to Convert Decimal to Hexadecimal in Python<\/h2>\n

Below are the ways to convert the given decimal number into hexadecimal :<\/p>\n