Computer Science, asked by shan2863, 1 year ago

Write an algorithm to find whether given number is odd or even.​

Answers

Answered by nutanjha95
6
The algorithm is a step by step representation of program. If the number is divisible by 2, means the remainder is 0 then the number is even. Otherwise number is odd.
...
First, simply compute a reminder and check, if it equals to 0 or 1:
bool IsEven(int number)
{
if(number % 2 == 0)
return true;
return false;
}
Similar questions