answersLogoWhite

0

function dec2bin($val){

if($val & 1){

$rval = '1';

}else{

$rval = '0';

}

$val >>= 1;

if($val > 0){

$rval = dec2bin($val) . $rval;

}

return $rval;

}

User Avatar

Wiki User

14y ago

What else can I help you with?

Related Questions

How we can convert decimal number into binary number in foxpro programming?

In FoxPro, you can convert a decimal number to a binary number using the DECIMAL() and STR() functions. First, use DECIMAL() to get the binary representation, then format it as a string using STR(). Here's an example: binaryString = STR(DECIMAL(decimalNumber, 2)). This will give you the binary equivalent of the decimal number.


How do you convert character to decimal integer?

In Excel it is the "code" function. For example, Code("A") = 65


Write a Program to convert decimal number into hexadecimal no without using function and string?

This is not a question.


How do you convert 3.5 into a decimal?

You cannot convert a decimal into a decimal!


How do you convert to a decimal 0.2?

0.2 already is a decimal. There is nothing to convert.0.2 already is a decimal. There is nothing to convert.0.2 already is a decimal. There is nothing to convert.0.2 already is a decimal. There is nothing to convert.


How do you convert 29.53 to a decimal?

Convert 29.53 to decimal


What is the INT functions?

The INT function is to convert something into an integer. An integer is a number that goes out two decimal places.


What is the formula in excel for counting base 8?

To convert from decimal to octal, use the function DEC2OCT.EXAMPLE: =DEC2OCT(58, 3) Converts decimal 58 to octal (072).


How do you get a convert a decimal into a percent?

multiply the decimal by 100 to convert it into a percent.


How do you convert in to a decimal number?

The answer will depend on what you want to convert into a decimal number.


What is simulation recursion in C?

The factorial f(n) = n * (n-1) * (n-2) * .. 1. For example factorial 5 (written as 5!) = 5 x 4 x 3 x 2 x 1 = 120. The function below returns the factorial of the parameter n. int factorial( int n) { if (n==1) return 1 else return n* factorial( n-1) ; }


How do you convert a number into an integer?

To convert a number into an integer in programming, you can use specific functions or methods depending on the language. For example, in Python, you can use the int() function, like int(3.7) which will return 3. In Java, you can cast a double to an integer using (int), such as (int) 3.7, which will also result in 3. This process typically truncates any decimal portion of the number.