Tuesday, September 14, 2010

Misconceptions

Last night I was fiddling around with some really simple code; the object of my program was to test a positive integer, to see if it was odd or even, and then print the result.  There is more than one way to do this, some being more expensive than others.  I thought I would run some tests to see what sort of differences, with regard to program execution time, I could come up with.  I had three methods of checking for whether a number was odd or even.