0
how to code to convert binary to decimal
2 Réponses
0
#include <iostream>
using namespace std;
int main()
{
long int n,s=0,j=1,p;
cin>>n;
while(n!=0)
{
p=n%10;
s=s+p*j;
j=j*2;
n=n/10;
}
cout<<"decimal equivalent="<<s;
return 0;
}