there is some n from 1 to 10

How to determine for n how many odd and even numbers in it are not including the last?

even. n = 8 ---> 2,4,6 -> 3 even

odd. n = 8 ---> 1,3,5,7 -> 4 odd

n = 3 -> one even 2

n = 3 -> one odd 1

Closed due to the fact that the subject of the question is not clear to Nicolas Chabanovsky ♦ 26 Dec '16 at 6:43 .

Try to write more detailed questions. To get an answer, explain what exactly you see the problem, how to reproduce it, what you want to get as a result, etc. Give an example that clearly demonstrates the problem. If the question can be reformulated according to the rules set out in the certificate , edit it .

  • What do you mean “in it”? The number is not set. - VladD
  • "in it" means in its range from 1 to n - Koki
  • well then (rl) / 2 well there + + - 1 add. - pavel
  • (n-1) / 2 even n / 2 odd - Alisher Yerkimbekov

1 answer 1

(n-1)/2 even
n/2 odd

Integer division

  • oh, how i'm inattentive. originally wrote it, but didn’t keep up with the order and wrote n-1/2 - Koki