PHP Compiler
<!DOCTYPE html> <html> <body> <?php $num = 23456; $arr = []; $answer = []; $value = 1; $j = 0; $count = -1; while($num > $value) { $count++; $value = pow(8, $count); $arr[$count] = $value; } $count = $count - 1; for($i=$count; $i>=0; $i--) { $answer[$j] = floor($num / $arr[$i]); $j++; $num = $num % $arr[$i]; } echo "Octal number of 23456 (decimal) is "; for($i=0; $i<=$count; $i++) echo $answer[$i]; ?> </body> </html>
OUTPUT
Octal number of 23456 (decimal) is 55640
×

Save as Private