RE: Determining Odd and Even Numbers

2004-08-05 Thread kamal.gupta
03, 2004 8:00 PM To: R. Kamal Raj Guptha (WT01 - TELECOM & INTER-NETWORKING SOLUTIONS); [EMAIL PROTECTED] Subject: RE: Determining Odd and Even Numbers From: <[EMAIL PROTECTED]> > Well, > > All the above said answers are perfectly fine, but just to make it > more efficient wha

Re: Re: Determining Odd and Even Numbers

2004-08-04 Thread Richard A. Evans
> The chosen examples struck me as funny. Movie Quiz time (probably just > for the americans): > > Ron: "Are you going to put in 220?" > Jack: "Yeh, 220 or 221 whatever it takes..." MR. MOM -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Determining Odd and Even Numbers

2004-08-03 Thread Jimstone77
Thanks everyone!

Re: Determining Odd and Even Numbers

2004-08-03 Thread Jeff 'japhy' Pinyan
On Aug 3, David Dorward said: >On 3 Aug 2004, at 13:26, [EMAIL PROTECTED] wrote: >> Does anyone know a simple way to determine if a number is odd or even? > >Use the modulus operator. If $foo % 2 has remainder 1, then it is odd, >if it has remainder 0, then it is even. While I find this a silly q

RE: Determining Odd and Even Numbers

2004-08-03 Thread Jenda Krynicky
From: <[EMAIL PROTECTED]> > Well, > > All the above said answers are perfectly fine, but just to make it > more efficient what we can do is, we can avoid the if statement or ?: > operator. > > This is because whenever we go for a decision statement, it takes some > extra processing time. Wheneve

RE: Determining Odd and Even Numbers

2004-08-03 Thread kamal.gupta
ED] Sent: Tuesday, August 03, 2004 6:24 PM To: [EMAIL PROTECTED] Subject: Re: Determining Odd and Even Numbers Thanks everyone! Confidentiality Notice The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addre

OT: Re: Determining Odd and Even Numbers

2004-08-03 Thread Wiggins d Anconia
> > > > Does anyone know a simple way to determine if a number is odd or even? For > example 220 would come out even while 221 would come out as an odd number. > > The chosen examples struck me as funny. Movie Quiz time (probably just for the americans): Ron: "Are you going to put in 220?

Re: Determining Odd and Even Numbers

2004-08-03 Thread Harald Richard Ashburner
[EMAIL PROTECTED] said: > > >Does anyone know a simple way to determine if a number is odd or even? For >example 220 would come out even while 221 would come out as an odd number. perl -e '($number % 2)?print "even":print "odd"; print "\n";' % is the modulus operator, and returns the remainder

Re: Determining Odd and Even Numbers

2004-08-03 Thread David Dorward
On 3 Aug 2004, at 13:26, [EMAIL PROTECTED] wrote: Does anyone know a simple way to determine if a number is odd or even? Use the modulus operator. If $foo % 2 has remainder 1, then it is odd, if it has remainder 0, then it is even. -- David Dorward

Determining Odd and Even Numbers

2004-08-03 Thread Jimstone77
Does anyone know a simple way to determine if a number is odd or even? For example 220 would come out even while 221 would come out as an odd number.

RE: Odd and even numbers

2002-10-09 Thread Jeff 'japhy' Pinyan
On Oct 9, Nikola Janceski said: >perl -e 'printf "%.0d\n", $ARGV[0]/2 if @ARGV' 5 > >Weird why doesn't this work they way I expect it to? >it returns 2 not 3. Blame C and the IEEE standards. -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734

Re: Odd and even numbers

2002-10-09 Thread shawn_milochik
: 10/09/2002 10:58 AMbcc: Subject: Odd and even numbers

Re: Odd and even numbers

2002-10-09 Thread Jenda Krynicky
From: "Zielfelder, Robert" <[EMAIL PROTECTED]> > I am trying to write a script that at one point needs to look at a > number and divide it by two. The results must always be an integer, > but the numerator can potentially be an odd number. What I want to do > is if the numerat

RE: Odd and even numbers

2002-10-09 Thread Nikola Janceski
AM > To: Perl Beginners List (E-mail) > Subject: Odd and even numbers > > > Greetings, > > I am trying to write a script that at one point needs to look > at a number > and divide it by two. The results must always be an integer, but the > numerator can potentially b

Re: Odd and even numbers

2002-10-09 Thread Janek Schleicher
Robert Zielfelder wrote: > I am trying to write a script that at one point needs to look at a number > and divide it by two. The results must always be an integer, but the > numerator can potentially be an odd number. So you just want to divide by 2 rounding up the result. use POSIX qw/ceil

Re: Odd and even numbers

2002-10-09 Thread Jean Padilla
Hi, $num += $num % 2; this increments $num if $num modulo 2 is 1 (ie. if $num was odd) regards. "Zielfelder, Robert" a écrit : > > Greetings, > > I am trying to write a script that at one point needs to look at a number > and divide it by two. The results must always be an integer, but the

Odd and even numbers

2002-10-09 Thread Zielfelder, Robert
Greetings, I am trying to write a script that at one point needs to look at a number and divide it by two. The results must always be an integer, but the numerator can potentially be an odd number. What I want to do is if the numerator is odd, increment it to the next highest even number. Is t