0

how to code to convert binary to decimal

18th Aug 2016, 2:05 PM
Varidh Srivastava
Varidh Srivastava - avatar
2 Answers
29th Apr 2017, 12:48 AM
P∆WAN M∆URY∆
P∆WAN M∆URY∆ - avatar
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; }
19th Aug 2016, 5:34 AM
Asim
Asim - avatar