I've always had access to Perl (well since I started using Linux in 1994) and yet I've laboured over writing things in C sometimes... like maths stuff! - fancy spending days writing and months tweaking a command line calculator program in C... now I have this *massive* perl script:
#!/usr/bin/perl -w
die "Usage: $0 MATHS\n" unless(@ARGV);for(@ARGV){s/x/*/g};
print eval(join('',@ARGV)),$/;
To convert a decimal number to binary in perl you could do:
unpack("B32", pack("N", $number));
and then chopping off the leading zeros... as per http://www.unix.org.ua/orelly/perl/cookbook/ch02_05.htm
... but TIMTOWTDI, you're better to use:
sprint("%08b", $number);