trying to simplify an algorithm

Dirk dirk.dil at pt.lu
Thu Feb 3 09:47:26 PST 2005


Hui Zhou (zhouhui at wam.umd.edu) wrote:
> On Thu, Feb 03, 2005 at 07:23:17AM -0700, Archaic wrote:
> >if a + b + c = 360
> > if a = b
> >   if b = c
> >     equilateral
> >   else
> >     isosceles
> > else
> >   if a = c || b = c
> >     isosceles
> >   else
> >     scalene
> >else
> > not a triangle
> >
> ></pseudo-code>
> 
> How about :
> if a + b + c = 360
>    if a = c || b = c || a = b
> 	if a = 60
# if b=c and a=60 this does not work
        if a=60 or b=60 or c=60  # would work
	(or a=b=c # maybe more elegant)
> 	    equilateral
> 	else
> 	    isosceles
>    else
> 	scalene
> else
>    not a triangle
> 
> -- 
> Hui Zhou
> -- 
> http://linuxfromscratch.org/mailman/listinfo/lfs-chat
> FAQ: http://www.linuxfromscratch.org/faq/
> Unsubscribe: See the above information page
> 



More information about the lfs-chat mailing list