Slyfoxx724

extra2.c

Dec 7th, 2016
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. 1 #include <stdio.h>
  2. 2 int main(void)
  3. 3 {
  4. 4 unsigned long long int base_10_number, remainder, quotient;
  5. 5 int binaryNumber[100], i=1, j;
  6. 6
  7. 7 printf("Enter a base_10 number from 0 --> 18,446,744,073,709,551,615\n ");
  8. 8 scanf("%llu", &base_10_number);
  9. 9
  10. 10 quotient = base_10_number;
  11. 11
  12. 12 while(quotient != 0)
  13. 13 {
  14. 14 binaryNumber[i] = quotient%2;
  15. 15 i++;
  16. 16 quotient = quotient/2;
  17. 17 }
  18. 18
  19. 19 printf("Equivalent binary value of base ten number %llu is ", base_10_ number);
  20. 20
  21. 21 for(j = i-1; j>0; j--)
  22. 22 printf("%i", binaryNumber[j]);
  23. 23
  24. 24 printf("\n");
  25. 25
  26. 26 return 0;
  27. 27 }
Add Comment
Please, Sign In to add comment