Velocity Reviews > Java > a problem

# a problem

bharath539@gmail.com
Guest
Posts: n/a

 02-10-2007
hi,
any one of the group ,please solve my problem
"is there is any method to find given number is even
or odd without using if ,else ,for,while,switch,conditional

Gordon Beaton
Guest
Posts: n/a

 02-10-2007
On 10 Feb 2007 06:15:46 -0800, http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> any one of the group ,please solve my problem
> "is there is any method to find given number is even
> or odd without using if ,else ,for,while,switch,conditional

Yes, there is. Problem solved!

/gordon

--
[ don't email me support questions or followups ]
g o r d o n + n e w s @ b a l d e r 1 3 . s e

Andrew Thompson
Guest
Posts: n/a

 02-10-2007
On Feb 11, 1:15 am, (E-Mail Removed) wrote:
> hi,
> any one of the group ,please solve my ..

...homework? What good would that do you?

Andrew T.

bharath
Guest
Posts: n/a

 02-10-2007
On Feb 10, 7:15 pm, (E-Mail Removed) wrote:
> hi,
> any one of the group ,please solve my problem
> "is there is any method to find given number is even
> or odd without using if ,else ,for,while,switch,conditional

bharath
Guest
Posts: n/a

 02-10-2007
On Feb 10, 7:18 pm, Gordon Beaton <(E-Mail Removed)> wrote:
> On 10 Feb 2007 06:15:46 -0800, (E-Mail Removed) wrote:
>
> > any one of the group ,please solve my problem
> > "is there is any method to find given number is even
> > or odd without using if ,else ,for,while,switch,conditional

>
> Yes, there is. Problem solved!
>
> /gordon
>
> --
> [ don't email me support questions or followups ]
> g o r d o n + n e w s @ b a l d e r 1 3 . s e

then post me the solution.Mr.Beaton

Andrew Thompson
Guest
Posts: n/a

 02-10-2007
On Feb 11, 3:32 am, "bharath" <(E-Mail Removed)> wrote:
> On Feb 10, 7:18 pm, Gordon Beaton <(E-Mail Removed)> wrote:
>
> > On 10 Feb 2007 06:15:46 -0800, (E-Mail Removed) wrote:

>
> > > any one of the group ,please solve my problem
> > > "is there is any method to find given number is even
> > > or odd without using if ,else ,for,while,switch,conditional
> > > operators,if else ladders...."

>
> > Yes, there is. Problem solved!

...
> then post me the solution.Mr.Beaton

(chuckle) More effective than making
demands of G.B. (or just about any
other member of these groups), might
or at least to consider what it means,

After all, we are having a discussion,
are we not?

Andrew T.

Gordon Beaton
Guest
Posts: n/a

 02-10-2007
On 10 Feb 2007 08:32:22 -0800, bharath wrote:
> then post me the solution.Mr.Beaton

However if you want to know *how* to determine the parity of a number
without using the mechanisms you mentioned earlier, then I'll give you
a hint: how would *you* (not a computer) decide whether a given number
was even or odd?

/gordon

--
[ don't email me support questions or followups ]
g o r d o n + n e w s @ b a l d e r 1 3 . s e

Flo 'Irian' Schaetz
Guest
Posts: n/a

 02-10-2007
And thus spoke (E-Mail Removed)...

> any one of the group ,please solve my problem
> "is there is any method to find given number is even
> or odd without using if ,else ,for,while,switch,conditional

"==" is allowed? Then it's easy to do.

Flo

Jeff
Guest
Posts: n/a

 02-10-2007
On Feb 10, 11:30 am, "bharath" <(E-Mail Removed)> wrote:
> On Feb 10, 7:15 pm, (E-Mail Removed) wrote:
>
> > hi,
> > any one of the group ,please solve my problem
> > "is there is any method to find given number is even
> > or odd without using if ,else ,for,while,switch,conditional

>
> Mr.Beaton,please send me the solution.

I would use a bitwise operator. But that's just me. It's not my
assignment, and I always hate assignments that artificially limit
choices - if teaching Java, why give an assignment that makes it so
you can't use normal Java constructs? I teach in a medical school and
this would be like asking how a student would diagnose pneumonia
without xray or stethoscope, and they can only ask two questions...
Useless.

Chris Uppal
Guest
Posts: n/a

 02-11-2007
Jeff wrote:

> I would use a bitwise operator. But that's just me. It's not my
> assignment, and I always hate assignments that artificially limit
> choices - if teaching Java, why give an assignment that makes it so
> you can't use normal Java constructs?

I suspect that a large part of this particular exercise is about understanding
boolean-valued expressions, as something more general than the XXX that goes in
an if (XXX) test.

-- chris