Helpppp my code (finding lcm usng assembly)

Discussion in 'Assembly Language Programming (ALP) Forum' started by msaina, Apr 3, 2007.

  1. msaina

    msaina New Member

    Joined:
    Apr 3, 2007
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    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 a moderator: Apr 3, 2007
  2. DaWei

    DaWei New Member

    Joined:
    Dec 6, 2006
    Messages:
    835
    Likes Received:
    5
    Trophy Points:
    0
    Occupation:
    Semi-retired EE
    Location:
    Texan now in Central NY
    Home Page:
    http://www.daweidesigns.com
    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.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice