#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;
}
write a c++ program to convert binary number to decimal number by using while statement
How is this a question? Sounds like you should do more of your homework offline.
Convert 189 to binary number
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.
The number 180 in binary is 10110100
#include<stdio.h> main() { int d,a; printf("enter the number"); scanf("%d",&a); do { d=a%2; } while(a=0); printf("binary=%d",&d); }
The binary equivalent of the hexadecimal number EF16 is 1110111100010110.
13 in decimal = 1101 in binary.
It is a number...11111,012 in binary
The number 111 in binary would be 1101111
The binary equivalent of the decimal number 63 is 111111.
Example Binary 00111000 Convert to Decimal 56 Convert to BCD by using groups of four binary numbers for each digit 5 6 0101 0110