even_odd function
1. Definition:
An integer is odd if it is not divided by two. Otherwise,
it is even. 13 is odd, but 12 is even ..
2. The method in C language:
#include <stdio.h>
/* Declaring an enumeration data type of name BOOLEAN */
enum BOOLEAN {false, true };
int is_odd ( int x){
if((x % 2) == 0)
return false;
else
return true;
}
int main()
{
int number;
printf("\n Enter a positive integer: --> ");
scanf("%d", &number);
if(is_odd(number))
printf("\n The number %d is odd. \n", number);
else
printf("\n The number %d is even. \n", number);
return 0;
}