Decimal to Biner with C

Follow Us to Update News :

/* 32 bit for negative */

#include< stdio.h > /* dont forget to delete space */

int binary(int a){

if(a>1){binary(a/2);}

printf("%d",a%2);

}


int main()

{ int in;

printf("Insert Decimal : ");

scanf("%d",&in);

if(in<0){in+=2147483647;in++;}

binary(in);

getchar();getchar();

return 0;

}
 
Tips dan Trik, Tips and Tricks © 2011 | Designed by Blogger Hacks | Blogger Template by ColorizeTemplates