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\
Pseudo code (i'm no C coder):
count = 0; foreach(i in range){ if(i % 2 == 0){ count++; } }