#include<iostream.h>
#include<conio.h>
void main()
{
int a;
cout<<"\n Enter a BCD number:";
cin>>a;
int t;
int r=0;
int i;
asm{
mov ax,a
ror ax,1
ror ax,1
ror ax,1
ror ax,1
ror ax,1
ror ax,1
ror ax,1
ror ax,1
and ax,000fh
mov i,ax
}
r=r*10+i;
asm{
mov ax,a
ror ax,1
ror ax,1
ror ax,1
ror ax,1
and ax,000fh
mov i,ax
}
r=r*10+i;
asm{
mov ax,a
and ax,000fh
mov i,ax
}
r=r*10+i;
cout<<"\n Binary Equivalent:"<<r;
getch();
}
/* Output
Enter a BCD number:54
Binary Equivalent:36
*/

*Related*