Mix Program in Assembly and C++ to Find Factorial of Number

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
short a;
unsigned int c;
cout<<"\n Enter Number between 0 to 8:";
cin>>a;
asm mov ax, 0000h
asm mov al, 01h
asm mov cx, 0000h
asm mov cx, a
bac:
asm mul cx
asm dec cx
asm jnz bac
asm mov c,ax
cout<<"\n Factorial of "<<a<<" is "<<c;
getch();
}

/* OUTPUT


 Enter Number between 0 to 8:6                                                  
                                                                                
 Factorial of 6 is 720                                                          

*/

One thought on “Mix Program in Assembly and C++ to Find Factorial of Number”

Leave a Reply

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