Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   a problem (http://www.velocityreviews.com/forums/t390756-a-problem.html)

 bharath539@gmail.com 02-10-2007 02:15 PM

a problem

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 02-10-2007 02:18 PM

Re: a problem

On 10 Feb 2007 06:15:46 -0800, bharath539@gmail.com 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 02-10-2007 02:27 PM

Re: a problem

On Feb 11, 1:15 am, bharath...@gmail.com wrote:
> hi,
> any one of the group ,please solve my ..

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

Andrew T.

 bharath 02-10-2007 04:30 PM

Re: a problem

On Feb 10, 7:15 pm, bharath...@gmail.com 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 02-10-2007 04:32 PM

Re: a problem

On Feb 10, 7:18 pm, Gordon Beaton <n...@for.email> wrote:
> On 10 Feb 2007 06:15:46 -0800, bharath...@gmail.com 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 02-10-2007 05:14 PM

Re: a problem

On Feb 11, 3:32 am, "bharath" <bharath...@gmail.com> wrote:
> On Feb 10, 7:18 pm, Gordon Beaton <n...@for.email> wrote:
>
> > On 10 Feb 2007 06:15:46 -0800, bharath...@gmail.com 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 02-10-2007 06:17 PM

Re: a problem

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 02-10-2007 08:00 PM

Re: a problem

And thus spoke bharath539@gmail.com...

> 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 02-10-2007 10:37 PM

Re: a problem

On Feb 10, 11:30 am, "bharath" <bharath...@gmail.com> wrote:
> On Feb 10, 7:15 pm, bharath...@gmail.com 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 02-11-2007 12:47 AM

Re: a problem

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

All times are GMT. The time now is 01:08 PM.