First please view my code below.
Code:
#include <stdio.h>
#include <conio.h>
void ReduceOddNumber(int n, int *result);
int main(void)
{
int n, result;
printf("Input integer: ");
scanf("%d", &n);
if( n & 1 == 1) // if last bit in numbers is 1, 'n' is odd , 0 for even
{
printf("Odd number.\n");
ReduceOddNumber(n, &result);
}
else
{
printf("Even number.\n");
}
}
void ReduceOddNumber(int n, int *result)
{
result =
}
I was newly learn Bitwise operators and now I have no ideas how to start with a simple thing. How can I reduce number by 1 by Bitwise operators? E.g. User input 15 then my program change to 14? Very thanks you.