What is the simplest way to calculate the amount of even numbers in a range of unsigned integers?
An example: if range is [0...4] then the answer is 3 (0,2,4)
I\
int start, stop; start = 0; stop = 9; printf("%d",(stop-start)/2+((!(start%2) || !(stop%2)) ? 1 : 0));
Where start and stop can hold any value. No need to iterate to to determine this number.