ZX BASIC:Fact.bas

From BorielWiki
Jump to: navigation, search
Program: fact.bas
REM Factorial recursive test
 
FUNCTION fact(x AS ULONG) AS ULONG
    IF x < 2 THEN
        RETURN 1
    END IF
 
    RETURN x * fact(x - 1)
END FUNCTION
 
CLS
FOR x = 1 TO 10:
    PRINT "Fact ("; x; ") = "; fact(x)
NEXT x
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox
Translate
Google AdSense