can someone give me a hint on how to write C programm with this output.
0
00000000 00000000 00000000 00000000
cammand
1
00000000 00000000 00000000 00000001
and so on

i ve try this but it doent work
scanf("%d",integer)
printf("\n wert war: %d,integer")
return 0;

There's no way to print a binary value directly in C. You have to break the value up into bits and basically do it all manually:

#include <stdio.h>

int main ( void )
{
  int x;

  printf ( "Enter a number: " );
  fflush ( stdout );

  if ( scanf ( "%d", &x ) == 1 ) {
    unsigned mask;
    int n = 0;

    for ( mask = ( -1U >> 1 ) + 1; mask != 0; mask >>= 1 ) {
      printf ( "%d", !!( x & mask ) );

      if ( ++n == 8 ) {
        printf ( " " );
        n = 0;
      }
    }

    printf ( "\n" );
  }

  return 0;
}

it works thankx

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.