#include<iostream.h>
#include<conio.h>
#include<math.h>
void main()
{
int a[10],i,no,sum=0,rem,j,k=0;
clrscr();
cout<<"Enter Binary No:";
cin>>no;
i=0;
while(no>0)
{
a[i]=no%10;
no=no/10;
i++;
}
for(j=0;j<i;j++)
{
sum=sum+a[j]*pow(2,k);
k++;
}
cout<<"Decimal NO:"<<sum;
getch();
}
Showing posts with label Binary to Decimal Number. Show all posts
Showing posts with label Binary to Decimal Number. Show all posts
Subscribe to:
Posts (Atom)
Related Post
Array:
String functions:
General (Loops-for/while)