Our technical scratch pad
so what about the case when "i" is negative, the result of "i%2" will be negative, that means it doesn't consider the case of negative values. Solution can be, "abs(i%2) == 1". This might solve it. Other than this I couldn't find any other problem.
Or make "i" an unsigned integer :)
Post a Comment
2 comments:
so what about the case when "i" is negative, the result of "i%2" will be negative, that means it doesn't consider the case of negative values. Solution can be, "abs(i%2) == 1". This might solve it. Other than this I couldn't find any other problem.
Or make "i" an unsigned integer :)
Post a Comment