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

#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 mov c,ax
cout<<"Result:";
cout<<c;
getch();
}

/*

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

*/

Leave a Reply

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