in reply to decimal to binary conversion
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);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: decimal to binary conversion
by AnomalousMonk (Archbishop) on Jun 05, 2015 at 01:14 UTC | |
by Hosen1989 (Scribe) on Jun 05, 2015 at 08:02 UTC | |
by AnomalousMonk (Archbishop) on Jun 05, 2015 at 15:24 UTC | |
by aaron_baugher (Curate) on Jun 05, 2015 at 16:12 UTC |