Mix (Assembly and C++) Program to Find Greatest of Two Numbers

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
short a;
short b;
cout<<"\n Enter First Number:";
cin>>a;
cout<<"\n Enter Second Number:";
cin>>b;
asm mov ax, 0000h
asm mov bx, 0000h
asm mov ax, a
asm mov bx, b
asm sub ax, bx
asm js true
cout<<"\n "<<a<<" is greater than "<<b;
asm jmp end
true:
cout<<"\n "<<b<<" is greater than "<<a;
end:
getch();
}

/* OUTPUT


 Enter First Number:5                                                           
                                                                                
 Enter Second Number:8                                                          
                                                                                
 8 is greater than 5                                                            
                                                                                
*/

Leave a Reply

Your email address will not be published. Required fields are marked *