Decimal To Binary in PHP
Q. Write a PHP program to convert a decimal number to binary
<?php // Define a decimal number $decimal = 25; // Convert using built-in function $binary = decbin($decimal); // Display the result echo "Decimal: $decimal<br>"; echo "Binary: $binary"; ?>
Q. Write an algorithm to convert decimal to binary in PHP (using built-in function)
1. Start 2. Define a decimal number decimal 3. Use decbin(decimal) to convert it to binary 4. Print the binary result 5. End
Quickly Find What You Are Looking For
OnlineTpoint is a website that is meant to offer basic knowledge, practice and learning materials. Though all the examples have been tested and verified, we cannot ensure the correctness or completeness of all the information on our website. All contents published on this website are subject to copyright and are owned by OnlineTpoint. By using this website, you agree that you have read and understood our Terms of Use, Cookie Policy and Privacy Policy.
point.com