include vcIO.inc
.data
yes byte "This year is leap year!",0ah,0h
no byte "This year is not leap year!",0ah,0h
four word 4
one_hundred word 100
four_hundred word 400
format byte "%d",
0
year word ?
.code
main proc
;read year -bx
invoke scanf , offset format , offset year
mov bx, year
xor dx,dx
mov ax,bx
div four_hundred
cmp dx,0
je then_body
;
xor dx,dx
mov ax,bx
div four
cmp dx,0
jne else_body
;
xor dx,dx
mov ax,bx
div one_hundred
cmp dx,0
je else_body
;
then_body:
invoke printf ,offset yes
jmp next
else_body:
invoke printf ,offset no
next:
invoke _getch
ret
main endp
end main
【汇编语言】判断闰年
最新推荐文章于 2021-12-14 10:31:55 发布