fork download
  1. #include<stdio.h>
  2. #include <math.h>
  3. int main() {
  4. long long a, m, t, B;
  5. long long p = 2147483647;
  6. int w = 8,i;
  7. int A[100];
  8. printf("Nhap vao a: ", a);
  9. scanf("%ld",&a);
  10. t=(int)log(p)/log(2) +1;
  11. if (t%w != 0) t=t/w +1;
  12. else t=t/w;
  13. A[0]=1;
  14. for( i = 1; i <=w*(t-1); i++)
  15.  
  16. A[i]=A[i-1]*2;
  17.  
  18.  
  19. for( i = (t-1); i>=0; i--){
  20. B=a/A[i*w];
  21. printf("%d\n",B);
  22. a=a%A[i*w];
  23. }
  24. }
Success #stdin #stdout 0.01s 5432KB
stdin
Standard input is empty
stdout
Nhap vao a: 8387810
125
241
128