Multifactorial: Difference between revisions
m
ANSI Standard BASIC and BBC BASIC moved to the BASIC section.
No edit summary |
m (ANSI Standard BASIC and BBC BASIC moved to the BASIC section.) |
||
Line 284:
</pre>
=={{header|ANSI Standard BASIC}}==▼
<syntaxhighlight lang="ansi standard basic">100 FUNCTION multiFactorial (n, degree)▼
110 IF n < 2 THEN ▼
120 LET multiFactorial = 1▼
130 EXIT FUNCTION▼
140 END IF▼
150 LET result = n▼
160 FOR i = n - degree TO 2 STEP -degree▼
170 LET result = result * i▼
180 NEXT i▼
190 LET multiFactorial = result▼
200 END FUNCTION▼
210▼
220 FOR degree = 1 TO 5▼
230 PRINT "Degree"; degree; " => ";▼
240 FOR n = 1 TO 10▼
250 PRINT multiFactorial(n, degree); " ";▼
260 NEXT n▼
270 PRINT ▼
280 NEXT degree▼
290 END</syntaxhighlight>▼
=={{header|Arturo}}==
Line 383 ⟶ 359:
</pre>
=={{header|
▲==={{header|ANSI Standard BASIC}}===
{{trans|FreeBASIC}}
▲<syntaxhighlight lang="ansi standard basic">100 FUNCTION multiFactorial (n, degree)
▲110 IF n < 2 THEN
▲120 LET multiFactorial = 1
▲130 EXIT FUNCTION
▲140 END IF
▲150 LET result = n
▲160 FOR i = n - degree TO 2 STEP -degree
▲170 LET result = result * i
▲180 NEXT i
▲190 LET multiFactorial = result
▲200 END FUNCTION
▲210
▲220 FOR degree = 1 TO 5
▲230 PRINT "Degree"; degree; " => ";
▲240 FOR n = 1 TO 10
▲250 PRINT multiFactorial(n, degree); " ";
▲260 NEXT n
▲270 PRINT
▲280 NEXT degree
▲290 END</syntaxhighlight>
==={{header|BBC BASIC}}===
<syntaxhighlight lang="bbcbasic">REM >multifact
FOR i% = 1 TO 5
|