Hello,
I saw it.
I have now this
It working now only not good.Code:/*
* * =====================================================================================
*
* Filename: test2.c
*
* Description: conventer from dec to 0101
*
* Version: 1.0
* Created: 14-05-11 10:03:25
* Revision: none
* Compiler: gcc
*
* Author: Dr. Fritz Mehner (mn), [email protected]
* Company: FH Südwestfalen, Iserlohn
*
* =====================================================================================
*/
#include <stdio.h>
#include <stdlib.h>
int
main ( int argc, char *argv[] )
{
int nummer, uitkomst, teller, teller2;
char uitkomst2[10];
nummer = 4 ;
uitkomst = 4 ;
teller = 0 ;
while (uitkomst > 0)
{
uitkomst = nummer / 2 ;
uitkomst2[teller++]= uitkomst%2;
nummer = uitkomst;
printf ("teller:%d deling:%d uitkomst deling:%d \n",teller, uitkomst%2, uitkomst);
}
teller2 = 1 ;
while (teller2 < teller)
{
printf("%d", uitkomst2[teller2]);
teller2 = teller2 + 1 ;
}
return EXIT_SUCCESS;
}
/*c---------- end of function main ---------- */
4 gets now the answer 10 where it must be 100
Roelof