Thursday, July 22, 2010

C++: A review exercise

A review exercise to go over what we've seen so far:

Hi, I would like to help kids learn more about odd and even numbers. I just
want students to type a number and have the computer say whether it's and
odd or an even number. This would be done repeatedly until a student types
negative 1. Do you have any idea how it can be done? Please help me do it
both in English and in a programming language.

JL: Actually, I do know how it can be done, but i will not tell you now -
the answer will be provided later. Few hints though: try using a variable
and try testing the input number. Also, you might want to try out modulus
operator for one of its tasks - tell me where and I'll write you a comment
on your Facebook page... Good luck.
// JL

No comments:

Post a Comment