Design a flowchart and write the corresponding program that prompts the user to enter an integer, and then displays a message indicating whether this number is odd or even.


In this exercise, you need to find a way to determine whether a number is odd or even. You need to find a common attribute between all even numbers, or between all odd numbers. And actually there is one! All even numbers are exactly divisible by 2. So, when the result of the operation X MOD 2 equals 0 (zero), X is even; otherwise, X is odd.

Next you can find various odd and even numbers:

  • Odd numbers: 1, 3, 5, 7, 9, 11, …
  • Even numbers: 0, 2, 4, 6, 8, 10, 12, ….

Notice: Please note that zero is considered an even number.

The flowchart is shown here.

and the program is shown here.





Visual Basic


Leave a Reply

Your email address will not be published. Required fields are marked *

This article is taken from a book of mine. If you enjoyed it, please visit my author's page inand check out all of my books!