Re: Stupid newbie question ? determine if intege r is even or odd
Re: Stupid newbie question ? determine if intege r is even or odd
- Subject: Re: Stupid newbie question ? determine if intege r is even or odd
- From: Isaac Sherman <email@hidden>
- Date: Tue, 13 Aug 2002 18:10:24 -0400
on 8/13/02 5:57 PM, the method -(id)email@hidden:(id) sender:@"Jan
Van Boghout"; returned:
>
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!
>
Modulo is your friend!
if (myInt%2==0) myIntIsEven();
else...
HTH,
--
Isaac Sherman
MotaSoft Software
http://homepage.mac.com/huperzoevs/
_______________________________________________
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.