diff --git "a/Convert Binary to Decimal\302\240program in C++" "b/Convert Binary to Decimal\302\240program in C++" new file mode 100644 index 00000000..3e5c6393 --- /dev/null +++ "b/Convert Binary to Decimal\302\240program in C++" @@ -0,0 +1,34 @@ +#include +#include +using namespace std; + +int main() + +{ + + long int i, no; + + int x, y = 0; + + cout << "Enter any binary number: "; + + cin >> no; + + cout << "\nThe decimal conversion of " << no << " is "; + + for (i = 0; no != 0; i++) + + { + + x = no % 10; + + y = (x) *(pow(2, i)) + y; + + no = no / 10; + } + + cout << y; + + return 0; + +}