kernelthread.com

Decimal to Binary

Introduction

A smallish program to print in binary the first (integer) argument it receives on the command line.

Source

C

main(int c,int*v){for(c=32;c--;putchar(atoi(v[1])&1<<c?49:48));}

Perl

for($i=32;$i--;){print($ARGV[0]&1<<$i?'1':'0');}

Download