C Program To Implement The Conversion From Binary To Decimal:Convert binary to decimal c code. The program uses the c program to find power concept. For example : 1011 can be calculated as for 1011.=>1*(2^3)+1*(2^2)+0*(2^1)+1*(2^0) => 8 + 4 + 0 + 1 => 11 .
ALGORITHM:-
step 1 : Start
step 2 : Enter the Binary number in form of (0101)
step 3 : Calc the Remainder using(%10)
step 4 : Add the remainer with Decimal number
step 5 : repeat until zero
step 6 : Display the decimal value
step 7 : Stop the Execution
PROGRAM CODE:-
#include<stdio.h>
#include<stdio.h>
#include
int main()
{
long int bn,dn=0,j=1,rem;
printf("Enter any binary number: ");
scanf("%ld",&bn);
while(bn != 0)
{
rem=bn%10;
dn=dn+rem*j;
j=j*2;
bn=bn/10;
}
printf("decimal value is : %ld",dn);
return 0;
}
OUTPUT:-
Enter any binary number : 1111
Decimal value is: 15
C Program To Convert Any binary number into decimal value How to convert binary number into decimal number using c Conversion of binary number to decimal number
ConversionConversion EmoticonEmoticon