RE: Stupid newbie question - determine if integer is even or odd
RE: Stupid newbie question - determine if integer is even or odd
- Subject: RE: Stupid newbie question - determine if integer is even or odd
- From: Kevin Elliott <email@hidden>
- Date: Tue, 13 Aug 2002 15:20:34 -0700
if(myval % 2 == 0)
{
//even
}
else
{
//odd
}
The operator is the "mod" operator. It returns the remainder after
division.
-Kevin Elliott
Software Engineer
CharisMac Engineering
>
----------
>
From: Jan Van Boghout
>
Sent: Tuesday, August 13, 2002 14:57
>
To: email@hidden
>
Subject: Stupid newbie question - determine if integer is even or odd
>
>
Hi everybody,
>
>
I feel kind of embarrassed to ask this, but I looked for hours and
>
still don't have a solution.
>
>
How do you determine whether an integer is odd or even? I tried messing
>
around with the fact that an odd integer divided by 2 would not be able
>
to be an integer again, but my attempts were unsuccesful :\ Any help
>
is welcome!
>
>
Thanks,
>
Jan VB
>
_______________________________________________
>
cocoa-dev mailing list | email@hidden
>
Help/Unsubscribe/Archives:
>
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
>
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.