0

write a c++ program to convert a binary to decimal number

Don't use arrays. and functions

26th Apr 2021, 10:38 PM
qais
qais - avatar
2 Respuestas
0
That's the answer. #include<iostream> using namespace std; int main() { int n, rem,dec = 0, b = 1; cout << " binary num "; cin >> n; while (n > 0) { rem = n % 10; dec = dec + rem * b; b *= 2; n/= 10; } cout << " decimal num " << " is " << dec; return 0; }
27th Apr 2021, 11:57 AM
qais
qais - avatar
+ 1
Hello, Hello! I hope you start write this c++ program? share it with us?
26th Apr 2021, 10:44 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar