Decimal to Hex
PHP
Medium
5 views
Problem Description
Convert an integer to uppercase hexadecimal (no 0x prefix).
Input Format
One integer n.
Output Format
Hex string.
Official Solution
<?php
$inputText=trim(stream_get_contents(STDIN));
if($inputText==='') exit;
$n=intval($inputText);
echo strtoupper(dechex($n));
?>
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!