How to find odd and even numbers in given number in c
Answers
Answered by
0
Odd or even program in C using modulus operator
We can use bitwise AND (&) operator to check odd or even, as an example consider binary of 7 (0111) when we perform 7 & 1 the result will be one, and you may observe that the least significant bit of every odd number is 1. Therefore (odd_number & 1) will be one always and also (even_number & 1) is always zero.
Attachments:
Similar questions
English,
6 months ago
English,
6 months ago
Computer Science,
6 months ago
Computer Science,
1 year ago
English,
1 year ago