Helpppp my code (finding lcm usng assembly)

msaina's Avatar, Join Date: Apr 2007
Newbie Member
The code is working to some point.Here is the code.Its an assignment and i have to forward it in 5 hours.
Code:
#include <stdio.h>

char format[] = "L.C.M = %d\n";
int a,b;


void main(){

	printf("Enter the first number ");
	scanf("%d",&a);
	printf("Enter the second number ");
	scanf("%d",&b);


	__asm{
       xor eax, eax
      
myLoop:
	   add eax, a
	   mov ebx, b
	   mov ecx, eax

	   div ebx

	   cmp edx, 0
	   mov eax, ecx

	   jnz myLoop

	   
	   push eax
	   mov eax, offset format
	   push eax
	   call printf
	   pop ecx
	   pop ecx


	}
}

Last edited by shabbir; 3Apr2007 at 12:25.. Reason: Code formatting.
0
DaWei's Avatar, Join Date: Dec 2006
Team Leader
And we're to guess at what point it fails? You won't help us help you by giving a clue? I can name two things that will make it fail, but they're not guesses, they're facts, so my guess is: they don't count.