Yes, of course :-)
Well, my
MIPS
assembly is rusty. The following code, however, produces the correct result (tested on a simulator)
li t0, 1 # t0 is the index of the loop (1..1000)
li t1, 0 # t1 is the sum of the selected numbers
# t2 is a temporary
li t3, 3 # t3 holds the constant number 3
li t5, 5 # t5 holds the constant number 5
li t7, 7 # t7 holds the constant number 7
loop:
rem t2, t0, t3
beq t2, zero, skipadd
nop
rem t2, t0, t5
bne t2, zero, skipadd
nop
rem t2, t0, t7
bne t2, zero, skipadd
nop
addu t1, t1, t0
skipadd:
addiu t0,t0, 1
li t2,1001
bne t0,t2, loop
nop
nop # here t1 contains the result