Hi there
please try this version of your code, it worked for me ^_^
#!/usr/bin/perl -w use strict; use warnings; print "Enter decimal number less than 256:"; my $decimal; $decimal=<STDIN>; chomp $decimal; # $decimal += 0; print (($decimal & 0x80) <=> 0); print (($decimal & 0x40) <=> 0); print (($decimal & 0x20) <=> 0); print (($decimal & 0x10) <=> 0); print (($decimal & 0x08) <=> 0); print (($decimal & 0x04) <=> 0); print (($decimal & 0x02) <=> 0); print (($decimal & 0x01) <=> 0);
In reply to Re: decimal to binary conversion
by Hosen1989
in thread decimal to binary conversion
by mp0065789
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |