Two-way_finite_state_machines Two-way_finite_state_machines

Read numbers and accumulate their sum per the following rules:

If the number is even
  add it to the sum
If the number is odd
  subtract it from the sum
If the number is less than zero
  discard it
If the number is equal to zero
  print the sum and stop.
Copyright 2009 WordIQ.com - Privacy Policy  :: Terms of Use  :: Contact Us  :: About Us