Advertisement
S0lll0s

sum of multiples of 3 and 5 smaller than 1000

Nov 8th, 2013
352
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. global _start
  2. section .text
  3.     _start:
  4.                         mov             cx, 0
  5.                         mov             ax, 0
  6.     _loop:
  7.                         cmp cx, 1000
  8.                         je  _done
  9.                         add cx, 3   ; next multiple of 3
  10.                         add ax, cx
  11.                         add cx, 2   ; next multiple of 5
  12.                         add ax, cx  ; #thinkoutofthebox
  13.                         sub cx, 5   ; reset
  14.                         jmp _loop
  15.  
  16.     _done:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement