Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
hello guys this is converting int to binary
my questions are :
in printf( " %i ", (arg1 & 1 << x ) > 0 ? 1 : 0 );
what is 1 doing with arg1?
how can I modify this into a program which converts FLOAT to binary?
void main( int argc, char *argv )
int arg1, x;
if( argc == 1 )
puts( "BINARY num = displays num in binary form." );
exit( 1 );
arg1 = atoi( argv );
printf( "INTEGER: %i
", arg1 );
printf( " BINARY:" );
printf( " " );
for( x = 7; x > -1; x-- )
printf( " %i ", (arg1 & 1 << x ) > 0 ? 1 : 0 );