Tim McGuire wrote:the final time through the loop, number-(i+1)-1 always evaluates to zero so num2 ends up being zero and this causes a division by zero error when you say array_hold[i]=(int)rl%num2;