Mix (C++ and Assembly) Program to Add Two 16 bit Numbers (With DAA)

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

/*

Enter First Number:500
Enter Second Number:617                                                         
Result:1123                                                                     
                                                                                

*/

Leave a Reply

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