determining how many odd numbers from n1 to n2

Jun 27, 2010 at 9:12am
hey guys, can anyone help me?.
i need a program that will count how many odd numbers there is from 1-100
using only ifelse statement or for loop...
Last edited on Jun 27, 2010 at 9:13am
Jun 27, 2010 at 9:17am
Do you have any code? We can't really help you without any code to look at.
Jun 27, 2010 at 9:37am
+1 to what firedraco said. To start, think about how you could use the modulo operator (%) to find out if a certain integer is an odd number.

http://www.cplusplus.com/doc/tutorial/operators/
Jun 27, 2010 at 6:08pm
I dont get it, why do you need a program for this ? Isnt the answer 50 by a trivial analysis ?
Jun 27, 2010 at 6:44pm
@DexterMorgan
Homework exercises, I presume. He's too lazy to make his own, so he asks here (no offence).
Topic archived. No new replies allowed.