C program even | odd without using arithmetic, logical and assignment operators.
Автор: Deed training and development
Загружено: 2016-05-11
Просмотров: 3947
Описание:
C program to find the given number is even or odd without using arithmetic, logical and assignment operators.
All even numbers equivalent binary numbers ends with zero digit.
All odd numbers equivalent binary numbers ends with one digit.
we perform Bitwise and (&) operator between given number and constant one (1).
All the even numbers end with zero digit so the is result zero.
All the odd numbers end with one digit so the is results one.
In general if condition, one is consider as true and zero is consider as false.
So odd numbers given to expression (n&1) results one evaluated as true and even numbers given to expression (n&1) results zero are evaluated as false.
Повторяем попытку...
Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: