Make a program where the program count the even's and odds in a interruptin

Razvancb

New member
Joined
Jan 21, 2016
Messages
3
Programming Experience
Beginner
Hello.


I need to make a program where the program count the even's and odds in a interval. Depending off the radiobutton (even or odd)

Example:

Break [0, 20] i click that i want even's, i got a message saying that i get 10 numbers in that break. If is [0,21] and i want the odds numbers i got a message saying that i have 11 numbers in that break.

Someone can help me? I really need help, i would like to unterstend the lines too, i really want to learn all about this, but i cant do anything.

Thank you!
 
If you want to do something for a range of integers then you use a For loop. You can test whether an Integer is even or odd using the Mod operator, i.e. Mod 2 is zero for even and not for odd. To count you simply increment a variable. Put those three things together and that's your calculation done.
 
Back
Top