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