• + 0 comments

    Your counter for the while loop starts at 0. It will compute the remainder modulo 0 in this first case, which does not make any sense.