Mail Archives: djgpp/1998/04/23/09:58:32
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");
______________________________ Reply Separator _________________________________
Subject: simple program problem!!!
Author: kenmel AT microtech DOT com DOT au at comsats
Date: 4/23/98 4:27 PM
I need help on a problem to do with a simple program for a course i am
currently studying. I know most of the people reading this are far more
advanced than the question, none the less I will still ask.
I need to write a program which obtains an integer value through the keyboard
and the displays whether the integer is an even number or an odd number. The
problem I have is - within the program how do I direct the program to
distinguish whether the value is an odd or even number?
Any help would be greatly appreciated.
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
- Raw text -