An even number is an integer number which is exactly divisible by 2.
Example: 0, 6, 8, 46, 168
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.
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, which is an operator that returns remainder value after division]
Now the next step (i.e. 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.
If the User Inputs 6, then
As Remainder is 0, 6 is an Even Number
Our Quiz prepared by Experts Helps you identify your knowledge in Algorithms. Everyone should atleast attempt this Quiz Once.
Please send sms (9731568158) any links or website about an "ARRAY" in C program i Don't no about pls ?? send me??????