trying to simplify an algorithm

Hui Zhou zhouhui at wam.umd.edu
Thu Feb 3 06:31:29 PST 2005


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
	    equilateral
	else
	    isosceles
    else
	scalene
else
    not a triangle

-- 
Hui Zhou



More information about the lfs-chat mailing list