Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # setting variables
- a=0
- i=0
- z=3
- x=5
- f=0
- b=0
- loop do #start loop
- i+=1 # i = i + 1
- if i >=1000 # if is 1000 or is greater than 1000
- break # then break loop
- elsif (i%z)==0 # otherwise, if i is divisible by 3, a = a + i
- a=a+i
- # p a
- else # else,
- next #repeat loop
- end
- end
- loop do
- f+=1
- if f>=1000
- break
- elsif (f%x)==0
- b=b+f
- # p b
- else
- next
- end
- end
- #a=a-i
- #b=b-f
- p a
- p b
- p a+b
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement