0
write a c++ program to convert a binary to decimal number
Don't use arrays. and functions
2 Respostas
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;
}
+ 1
Hello, Hello! I hope you start write this c++ program? share it with us?