Advertisement
Guest User

Untitled

a guest
May 28th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5. int i = 0, temp, k, a[15], count = 0, num, t, run;
  6. scanf("%d\n",&run);
  7. for(k = 0; k < run; k++)
  8. {
  9. scanf("%d",&num);
  10. temp = num;
  11. while(temp != 0)
  12. {
  13. count++;
  14. t = temp % 2;
  15. printf("%d\t",t);
  16. a[i] = t;
  17. i++;
  18. temp = temp / 2;
  19. }
  20. for(i = 0; i < count; i++) {
  21. printf("%d",a[i]);
  22. }
  23. }
  24. return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement