answersLogoWhite

0

#include <stdio.h>

#include <conio.h>

long ConvertDecimal2Binary(long dec)

{

long bin = 0, pos = 1;

while(dec > 0)

{

bin = bin + (dec % 2) * pos;

dec = dec / 2;

pos *= 10;

}

return bin;

}

int main()

{

for(long i = 0; i < 128; i++)

{

if(i > 16)

i += 7;

printf("\n%3ld = %08ld", i, ConvertDecimal2Binary(i));

}

printf("\n\n");

return 0;

}

User Avatar

Wiki User

13y ago

What else can I help you with?

Related Questions

How do you write a c program to convert binary to decimal by using while statement?

write a c++ program to convert binary number to decimal number by using while statement


Write a c program to convert binary number to decimal number?

How is this a question? Sounds like you should do more of your homework offline.


Convert 186 decimal numbers to its binary equivalent?

Convert 189 to binary number


How do you convert binary to excess 3 code?

To convert a binary number to Excess-3 code, first, convert the binary number to its decimal equivalent. Then, add 3 to the decimal value. Finally, convert the resulting decimal number back to binary. For instance, to convert the binary number 1010 (which is 10 in decimal), you would calculate 10 + 3 = 13, and then convert 13 back to binary, resulting in 1101 in Excess-3 code.


How do you Convert 180 into binary?

The number 180 in binary is 10110100


C program to convert decimal number into binary number?

#include&lt;stdio.h&gt; main() { int d,a; printf("enter the number"); scanf("%d",&amp;a); do { d=a%2; } while(a=0); printf("binary=%d",&amp;d); }


Convert EF16 to a binary number?

The binary equivalent of the hexadecimal number EF16 is 1110111100010110.


Convert 13 into a binary number?

13 in decimal = 1101 in binary.


How do you convert 31.25 into a number?

It is a number...11111,012 in binary


Convert whole number 111 to its binary equivalent?

The number 111 in binary would be 1101111


How do you convert decimal number 63 to binary?

The binary equivalent of the decimal number 63 is 111111.


How do you convert binary number to bcd number on paper?

Example Binary 00111000 Convert to Decimal 56 Convert to BCD by using groups of four binary numbers for each digit 5 6 0101 0110