Find out number of odd/even number between m and n


solution :

how does this formula for counting odd numbers work? The number of odd numbers between 45-243 and 1-198 (1 to (243-45) ) is supposed to be the same, right? then if i subtract 198/2 then there should be 99 even numbers and 99 odd numbers right?

I dont understand why this is so unnecessarily complicated just use sum of an arithmetic progression formula