I think tadman's answer in the previous thread was more elegant (but apparently it only works in 5.6 or higher):print "Enter a decimal number: "; chomp( $decimal = <STDIN> ); $binary = ''; while( $decimal ){ $binary = $decimal%2 . $binary; $decimal = int( $decimal/2 ); } print STDOUT $binary;
In reply to Re: Re: Base10 to Base2.
by strider corinth
in thread Base10 to Base2.
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |