Just another update
This commit is contained in:
parent
a25938f123
commit
00a190b0a6
6591 changed files with 94363 additions and 23227 deletions
|
|
@ -1 +1,3 @@
|
|||
Start with a value at 0. Loop while value mod 6 is not equal to 0. Each time through the loop, add 1 to the value then print it. The loop must execute at least once.
|
||||
Start with a value at 0. Loop while value mod 6 is not equal to 0.
|
||||
Each time through the loop, add 1 to the value then print it.
|
||||
The loop must execute at least once.
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
---
|
||||
category:
|
||||
- Conditional loops
|
||||
- Simple
|
||||
note: Iteration
|
||||
|
|
|
|||
26
Task/Loops-Do-while/360-Assembly/loops-do-while.360
Normal file
26
Task/Loops-Do-while/360-Assembly/loops-do-while.360
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
DOWHILE CSECT , -This program's control section
|
||||
BAKR 14,0 -Caller's registers to linkage stack
|
||||
LR 12,15 -load entry point address into Reg 12
|
||||
USING DOWHILE,12 -tell assembler we use Reg 12 as base
|
||||
XR 9,9 -clear Reg 9 - divident value
|
||||
LA 6,6 -load divisor value 6 in Reg 6
|
||||
LA 8,WTOLEN -address of WTO area in Reg 8
|
||||
LOOP DS 0H
|
||||
LA 9,1(,9) -add 1 to divident Reg 9
|
||||
ST 9,FW2 -store it
|
||||
LM 4,5,FDOUBLE -load into even/odd register pair
|
||||
STH 9,WTOTXT -store divident in text area
|
||||
MVI WTOTXT,X'F0' -first of two bytes zero
|
||||
OI WTOTXT+1,X'F0' -make second byte printable
|
||||
WTO TEXT=(8) -print it (Write To Operator macro)
|
||||
DR 4,6 -divide Reg pair 4,5 by Reg 6
|
||||
LTR 5,5 -test quotient (remainder in Reg 4)
|
||||
BNZ RETURN -if one: 6 iterations, exit loop.
|
||||
B LOOP -if zero: loop again.
|
||||
RETURN PR , -return to caller.
|
||||
FDOUBLE DC 0FD
|
||||
DC F'0'
|
||||
FW2 DC F'0'
|
||||
WTOLEN DC H'2' -fixed WTO length of two
|
||||
WTOTXT DC CL2' '
|
||||
END DOWHILE
|
||||
5
Task/Loops-Do-while/Emacs-Lisp/loops-do-while.l
Normal file
5
Task/Loops-Do-while/Emacs-Lisp/loops-do-while.l
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
(let ((val 0))
|
||||
(while (progn
|
||||
(setq val (1+ val))
|
||||
(message "%d" val)
|
||||
(/= 0 (mod val 6)))))
|
||||
12
Task/Loops-Do-while/Euphoria/loops-do-while.euphoria
Normal file
12
Task/Loops-Do-while/Euphoria/loops-do-while.euphoria
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
include std/console.e
|
||||
include std/math.e
|
||||
|
||||
atom x = 0
|
||||
|
||||
loop do
|
||||
x += 1
|
||||
?x
|
||||
until(mod(x,6)) = 0
|
||||
end loop
|
||||
|
||||
if getc(0) then end if
|
||||
3
Task/Loops-Do-while/NewLISP/loops-do-while.newlisp
Normal file
3
Task/Loops-Do-while/NewLISP/loops-do-while.newlisp
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
(let ((i 0))
|
||||
(do-until (= 0 (% i 6))
|
||||
(println (++ i))))
|
||||
18
Task/Loops-Do-while/Oberon-2/loops-do-while.oberon-2
Normal file
18
Task/Loops-Do-while/Oberon-2/loops-do-while.oberon-2
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
MODULE LoopDoWhile;
|
||||
IMPORT
|
||||
Out;
|
||||
|
||||
PROCEDURE Do();
|
||||
VAR
|
||||
i: INTEGER;
|
||||
BEGIN
|
||||
i := 0;
|
||||
REPEAT
|
||||
Out.LongInt(i,0);Out.Ln;
|
||||
INC(i)
|
||||
UNTIL (i MOD 6 = 0);
|
||||
END Do;
|
||||
|
||||
BEGIN
|
||||
Do
|
||||
END LoopDoWhile.
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
DEFINE VARIABLE ii AS INTEGER.
|
||||
|
||||
DO WHILE ii MODULO 6 <> 0 OR ii = 0:
|
||||
ii = ii + 1.
|
||||
MESSAGE ii VIEW-AS ALERT-BOX.
|
||||
END.
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
x = 0;
|
||||
while(1,
|
||||
print(x++);
|
||||
if(val % 6 == 0, break)
|
||||
if(x % 6 == 0, break)
|
||||
)
|
||||
2
Task/Loops-Do-while/PARI-GP/loops-do-while-2.pari
Normal file
2
Task/Loops-Do-while/PARI-GP/loops-do-while-2.pari
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
x = 0;
|
||||
while (print(x++) || x % 6, )
|
||||
5
Task/Loops-Do-while/Suneido/loops-do-while.suneido
Normal file
5
Task/Loops-Do-while/Suneido/loops-do-while.suneido
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
val = 0
|
||||
do
|
||||
{
|
||||
Print(++val)
|
||||
} while (val % 6 isnt 0)
|
||||
Loading…
Add table
Add a link
Reference in a new issue