You get 6 if your THEN/ELSE clauses are swapped.So far, so good. Except the Comal runs far too quickly and returns the wrong answer (6, it should be 7).
Here is working code on COMAL 80 for C64:
Code:
0010 FUNC tak(x#,y#,z#)0020 IF y#<x# THEN0030 RETURN tak(tak(x#-1,y#,z#),tak(y# -1,z#,x#),tak(z#-1,x#,y#))0040 ELSE0050 RETURN z#0060 ENDIF0070 ENDFUNC tak0080 TIME 00090 PRINT tak(18,12,6)0100 PRINT TIME/60,"s"0110 END
I haven't had much luck running AcornSoft COMAL, but I know it uses the nonstandard END IF and END FUNC syntax
Statistics: Posted by scruss — Tue Oct 08, 2024 1:18 am