|
|
| How can a program be written to tell the difference between even and odd numbers? |
It would be possible to have the RCX or NXT count up to the number with a container, toggling between even and odd, but that wouldn't be as rapid a solution for very large values to test.
This part of the program tests whether or not the value in the red container is even or odd. The yellow container is zero for even and one for odd.

Here is that same piece of code in a program:

AG ses
|