Re: How to find the greatest of two numbers without using the comparison operators?



On Fri, 31 Aug 2007 13:09:34 GMT, "Michael Mattias"
<mmattias@xxxxxxxxxxxxxx> wrote:



"Aparajita" <aparajita.mohanty@xxxxxxxxx> wrote in message
news:1188561799.566239.84930@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi,

I want to find the greatest of two given numbers say 'A' and 'B.

or your response.
I got an alternate solution,
like this
IF A-B IS POSITIVE
DISPLAY "A IS GREATER"
ELSE
DISPLAY "B IS GREATER"
END-IF.

What is your opinion on the above solution? Or if you find any
limitations or constraints with this code, please let me know.

I use three (3) tests for code:

1. Works correctly?
2. Relatively efficient?
3. Maintainable?

If 'yes' to all, it's a keeper.


MCM


You need a 4th in this case Michael.

4. Is this what the teacher wanted?

Regards,
////
(o o)
-oOO--(_)--OOo-

"I'm not afraid of dying. I just don't want to
be there when it happens."
--Woody Allen
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Remove nospam to email me.

Steve
.



Relevant Pages

  • Re: Best way of developing simple PPC apps for Unix types?
    ... which I would like to be the same on the web server and the PPC), ... display data in a tabular form, allow selection of an item and display ... The truth is the truth, and opinion just opinion. ...
    (microsoft.public.pocketpc.developer)
  • Re: vc 6 ide or vsnet2005 better debugger?
    ... So far I haven't got one opinion:) ... >> Which of the 2 has an easier to use debugger, ... >> display, stepping, function returns, stack display etc. ... > Peter [MVP Visual Developer] ...
    (microsoft.public.vsnet.ide)
  • Re: Photos of Soham cycle bridge
    ... If there were no signage, then it could not in my opinion be promoted into a shared use path by a display in the village hall, no matter how magnificent the display was. ... You apparently disagree ... The> construction company said they were building a cycle path. ...
    (uk.rec.cycling)
  • Re: Update an Entry on Button-1 click
    ... Marc Dashevsky wrote: ... My display runs ... Yes, i have thought of that, and i respect your opinion as someone who ... Thank you for the advise and help Marc. ...
    (comp.lang.perl.tk)
  • Re: VB.NET: Transferring Data From Form to Form
    ... method of passing data to a form for display is either by a property ... In my opinion, public variables (that is global to the whole ... *reference* to that form is. ...
    (microsoft.public.dotnet.languages.vb)