aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHVukman <peterslopp@googlemail.com>2025-09-07 21:23:51 +0200
committerGitHub <noreply@github.com>2025-09-07 21:23:51 +0200
commit7ddfbd02b89c453f8f84727132d2d57eeec8a36e (patch)
tree35f61b3cd848d4ec29381a4c14e0c937b99d53e5
parent1e4fab6aa587989775539cd65045b2cefbc2407e (diff)
downloadperlweeklychallenge-club-7ddfbd02b89c453f8f84727132d2d57eeec8a36e.tar.gz
perlweeklychallenge-club-7ddfbd02b89c453f8f84727132d2d57eeec8a36e.tar.bz2
perlweeklychallenge-club-7ddfbd02b89c453f8f84727132d2d57eeec8a36e.zip
Create 337_p1.lua
-rw-r--r--challenge-337/hvukman/lua/337_p1.lua19
1 files changed, 19 insertions, 0 deletions
diff --git a/challenge-337/hvukman/lua/337_p1.lua b/challenge-337/hvukman/lua/337_p1.lua
new file mode 100644
index 0000000000..1277d8c1d8
--- /dev/null
+++ b/challenge-337/hvukman/lua/337_p1.lua
@@ -0,0 +1,19 @@
+local inputs = { {6, 5, 4, 8},{7,7,7,7},{5, 4, 3, 2, 1},
+ {-1, 0, 3, -2, 1},{0, 1, 1, 2, 0} }
+
+function Smaller(X)
+ for i,v in ipairs(X) do
+ local int = 0
+ for j,w in ipairs(X) do
+ if v>= w and i~=j then
+ int = int +1
+ end
+ end
+ io.write(int," ")
+ end
+ io.write("\n")
+end
+
+for i=1,#inputs do
+ Smaller(inputs[i])
+end