The only thing in the while loop is you didn't increment i

Same in the do-while, and you didn't initialize i

Other than that, looks good.