mirror of
https://github.com/ProgramSnail/Lama.git
synced 2025-12-05 22:38:44 +00:00
Converted repeat .. until .. -> do .. while .. od
This commit is contained in:
parent
297139c72a
commit
919cda5556
7 changed files with 17 additions and 18 deletions
|
|
@ -1,6 +1,6 @@
|
|||
local n = read ();
|
||||
|
||||
repeat
|
||||
do
|
||||
|
||||
if n == 1 then write (0)
|
||||
elif n == 2 then write (1)
|
||||
|
|
@ -13,4 +13,4 @@ elif n == 4 then write (3)
|
|||
|
||||
n := n - 1
|
||||
|
||||
until (n == 0)
|
||||
while n != 0 od
|
||||
|
|
@ -4,11 +4,11 @@ n := read ();
|
|||
|
||||
s := 1;
|
||||
|
||||
repeat
|
||||
do
|
||||
|
||||
s := s * n;
|
||||
n := n - 1
|
||||
|
||||
until (n == 0);
|
||||
while n != 0 od;
|
||||
|
||||
write (s)
|
||||
|
|
@ -2,9 +2,9 @@ local s, n;
|
|||
|
||||
s := 0;
|
||||
|
||||
repeat
|
||||
do
|
||||
n := read ();
|
||||
s := s + n
|
||||
until (n == 0);
|
||||
while n != 0 od;
|
||||
|
||||
write (s)
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
local x;
|
||||
|
||||
repeat
|
||||
do
|
||||
local n = read ();
|
||||
x := n
|
||||
until n > 0;
|
||||
while n <= 0 od;
|
||||
|
||||
write (x)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue