fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4.  
  5. int i=0,k,n=5,p,x;
  6. int a[5]={0};
  7. printf("Podaj liczbe");
  8. scanf("%d",&x);
  9. do
  10. {
  11. if(x%2)
  12. a[i++]=1;
  13. else
  14. a[i++]=0;
  15. x=x/2;
  16. }
  17. while(x>0);
  18. for(i=0;i<5;i++) printf("%d",a[i]);
  19. printf("\n");
  20.  
  21. return 0;
  22. }
Success #stdin #stdout 0s 1836KB
stdin
5
stdout
Podaj liczbe10100