C++program for binary number to decimal number
C++program for binary number to decimal number
#include<iostream>
using namespace std;
int main()
{
int b, d=0, i=1, r;
cout<<"Enter any Binary Number: ";
cin>>b;
while(b!=0)
{
r = b%10;
d = d + (r*i);
i = i*2;
b = b/10;
}
cout<<"\n Decimal Value = "<<d;
return 0;
}
Algorithm step1 start
Step 2 enter value
Step 3 while(b!=0) { r = b%10;d = d + (r*i); i = i*2; b=b/10;}
Step4 stop
Comments
Post a Comment