ComputerShikshak.com

Flowchart - Even or Odd Number

Problem Statement

Draw a Flowchart to check whether a number is Even or Odd.

Brief Description

According to the problem statement we have to draw a flowchart that will check whether a given number is even or odd.

An integer number which is exactly divisible by 2 is an even number otherwise it is odd.

In other words when an integer number is divided by 2 and as remainder 0 is obtained then that is an even number otherwise that is an odd number.

For example, if 8 is given as input, we will get “Even” as output since 8 is an even number. But if 5 is given as input, we will get “Odd” as output since 5 is an odd number.

Flowchart

Explanation

In order to draw the flowchart given above the following steps are taken into consideration:
  • At first a number is taken as input from the user and is stored in a variable namely num.
  • Then the given number is checked to see whether it is exactly divisible by 2 or not.
    • If it is then we can conclude that the given number is even and “Even” is displayed as output.
    • If it is not then we can conclude that the given number is odd and “Odd” is displayed as output.
Note:-
  • % is known as modulo division operator which gives remainder after integer division.
  • Thus, the expression num%2 will give the remainder after dividing the value stored in num by 2.
  • For an even number num%2 will give 0 as remainder because an even number is exactly divisible by 2 but for an odd number num%2 will not give 0 as remainder because an odd number is not exactly divisible by 2.
Share this page on
Scroll to Top