C语言描述该程序流程:
#include <stdio.h> int main() { int a=10,b=20,c=15; //scanf("%d %d",&a,&b); if(a>=b) { if(a>=c) { printf("%d",c); } else { printf("%d",a); } } else { if(b>=c) { printf("%d",b); } else { printf("%d",c); } } }
汇编语言:
include irvine32.inc .data num1 dword 10 num2 dword 20 num3 dword 15 max dword ? .code main proc mov eax,num1 cmp eax,num2 jl num2g ;如果num1比num2小,则对num2和num3做比较找最大值 cmp eax,num3 ;否则num1和num3做比较找最大值 jl num3g jmp done num2g: mov eax,num2 cmp eax,num3 jl num3g jmp done num3g: mov eax,num3 done: call writeint main endp end main
运行结果: