Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
54
Task/Ackermann-function/ERRE/ackermann-function.erre
Normal file
54
Task/Ackermann-function/ERRE/ackermann-function.erre
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
PROGRAM ACKERMAN
|
||||
|
||||
!
|
||||
! computes Ackermann function
|
||||
! (second version for rosettacode.org)
|
||||
!
|
||||
|
||||
!$INTEGER
|
||||
|
||||
DIM STACK[10000]
|
||||
|
||||
!$INCLUDE="PC.LIB"
|
||||
|
||||
PROCEDURE ACK(M,N->N)
|
||||
LOOP
|
||||
CURSOR_SAVE(->CURX%,CURY%)
|
||||
LOCATE(8,1)
|
||||
PRINT("Livello Stack:";S;" ")
|
||||
LOCATE(CURY%,CURX%)
|
||||
IF M<>0 THEN
|
||||
IF N<>0 THEN
|
||||
STACK[S]=M
|
||||
S+=1
|
||||
N-=1
|
||||
ELSE
|
||||
M-=1
|
||||
N+=1
|
||||
END IF
|
||||
CONTINUE LOOP
|
||||
ELSE
|
||||
N+=1
|
||||
S-=1
|
||||
END IF
|
||||
IF S<>0 THEN
|
||||
M=STACK[S]
|
||||
M-=1
|
||||
CONTINUE LOOP
|
||||
ELSE
|
||||
EXIT PROCEDURE
|
||||
END IF
|
||||
END LOOP
|
||||
END PROCEDURE
|
||||
|
||||
BEGIN
|
||||
PRINT(CHR$(12);)
|
||||
FOR X=0 TO 3 DO
|
||||
FOR Y=0 TO 9 DO
|
||||
S=1
|
||||
ACK(X,Y->ANS)
|
||||
PRINT(ANS;)
|
||||
END FOR
|
||||
PRINT
|
||||
END FOR
|
||||
END PROGRAM
|
||||
Loading…
Add table
Add a link
Reference in a new issue