I need a program to convert Binary numbers into Decimal number in Java or in C++.
is there some one who can help me.
Use binary expansion. For example 1101 1001 is:
(1 x 2^7) + (1 x 2^6) + (1 x 2^4) + (1 x 2^3) + (1 x 2^0)
which is equal to:
217 in decimal.
Here is the algorithm:
1.) Prompt the user for a binary number.
2.) Store the number in an array. The first element i.e. anArray[0] should contain a value of 1, the second element should have a value of 0 . . .
3.) Implement a for loop to do the calculation.