C语言描述:
#include <stdio.h> int main() { for(int i=1;i<=9;i++) { for(int j=1;j<=i;j++) { printf("%d*%d=%d ",i,i,i*j); } printf("\n"); } }
汇编语言:
INCLUDE Irvine32.inc .data .code main PROC mov esi, 1 outLoop: cmp esi,10 jge final mov edi,1 inLoop: cmp edi, esi jg next mov eax,edi call writedec mov al,'*' call writechar mov eax,esi call writedec mov al,'=' call writechar mov eax,esi mov ecx,edi mul ecx call writedec mov al,' ' call writechar inc edi jmp inLoop next: call crlf inc esi jmp outLoop final: popad exit main ENDP END main
运行结果: