Mail Archives: djgpp/1998/04/24/08:01:49
altaf.aali wrote:
>
> simply add this code snippet....
> // I assume you have declared the input value as int value
> int remainder;
>
> remainder = value%2; // take the mod of the number with 2
> if (!remainder) // if there is no remainder
> printf ("Even number");
> else
> printf ("Odd number");
an odd integer has bit 0 set. simply test for that. (no code, since i
don't like doing others' homeworks.)
--
----------------------------------------------------------------------
A. Sinan Unur
Department of Policy Analysis and Management, College of Human Ecology,
Cornell University, Ithaca, NY 14853, USA
mailto:sinan DOT unur AT cornell DOT edu
http://www.people.cornell.edu/pages/asu1/
- Raw text -