Values are correct. Program does not end correctly(does not reach end condition). Need to make last step to work for more than 1 iterations