//Convert this nested for loop to assembly instructions for (a=0; a<=y; a++) for (b=0; b<=y/2; b++) for (c=0; c<=y/3; c++) if ((a + 2*b + 3*c) == y) count++;
this is the assembly which i converted n got error
MOV y,C2
LOOP1:
CMP B1(a),C2(y)
JG END ;if a>y , jump to end
LOOP2:
MOV C2(y),AX
DIV AX,2 ;
CMP B2(B)/>/>,
JG LOOP1A ;
LOOP3:
MOVE C2(y),AX
DIV AX,3 ;
CMP C1(c),
JG LOOP2A ;
((a + 2*b + 3*c) == y)
INC C1(c) ;c++
JMP LOOP3
LOOP2A:
INC B2(B)/>/> ; b++
JMP LOOP2;
LOOP1A:
INC B1(a) ;a++
JMP LOOP1;

New Topic/Question
Reply



MultiQuote








|