Mix (C++ and Assembly) Program to Subtract Two 8 bit Numbers

#include<iostream.h>
#include<conio.h>
#include<stdio.h>
void main()
{
clrscr();
short int a,b,c;
cout<<"Enter First Number:";
cin>>a;
cout<<"Enter Second Number:";
cin>>b;
asm mov ax,a
asm mov ah,00h
asm mov bx,b
asm mov bh,00h
asm sub al,bl
asm mov c,ax
cout<<"Result:";
cout<<c;
getch();
}

/*

Enter First Number:51
Enter Second Number:12                                                          
Result:39                                                                       
                                                                                
*/

One thought on “Mix (C++ and Assembly) Program to Subtract Two 8 bit Numbers”

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.