Algorithm and Flowchart to find Whether a Number is Even or Odd

[17710 views]


What is an Even Number?

An even number is an integer number which is exactly divisible by 2.
Example: 0, 6, 8, 46, 168

What is an Odd Number?

An odd number is an integer which is not exactly divisible by 2.
Example: 1, 9, 13, 19, 51, 101

Now if you understood the definitions of Odd and Even Number properly you can easily come to a conclusion that if a number is exactly divisible by 2, then the number is considered as an even number else the number will be considered as an odd number. So now lets see the Flowchart and Pseudocode for better understanding.

Flowchart to Find Whether a Number is Even or Odd


Flowchart to Find whether a Number is Even or Odd

Pseudocode to Find Whether a Number is Even or Odd


READ number remainder=number%2 IF remainder==0 WRITE "Even Number" ELSE WRITE "Odd Number" ENDIF

The first step in the algorithm is taking a number as an input from User. Let's say user enters value 6. So 6 will be stored inside variable "number".
Now the next step in algorithm (i.e number%2==0), in this step (number%2) returns the remainder after dividing number by 2.
[Note: Here % is known as modulus and it is an operator that returns remainder value after division]
Now the next step (remainder==0) simply checks if the remainder value is equal to 0 or not.
So if the remainder is 0, then the number is said to be Even number else it is said to be an Odd Number.

For User Input 6,
number=6
Remainder=number%2
i.e Remainder =6%2
Remainder=0
As Remainder is 0, 6 is an Even Number

        


Need Programming or any Technical Related Books, Courses or Help Chat with us

Myntra [CPS] IN

Comments

1 comment
  • Manoj r b

    Please send sms (9731568158) any links or website about an "ARRAY" in C program i Don't no about pls ?? send me??????



Deals of the Day




Norton [CPS] WW

Search
Online Games
Play 2048 Game Online and Relax.
Play 2048 Game Online


Search Tags

    Flowchart for Odd and Even

    Algorithm for Even and Odd

    Find if a number is Even or Odd Algorithm

    Algorithm to check if number is odd or even