Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Conta valores acima da média - LUA
local sum, result = 0, 0 local intlist = {} listlen = io.read("*n"); if (listlen > 0 and listlen < 100) then -- Read input into an array and compute the sum for counter = 1, listlen, 1 do intlist[counter] = io.read("*n"); sum = sum + intlist[counter]; end -- Compute the average average = sum / listlen; -- Count the input values that are > average for num, value in ipairs(intlist) do if (num > average) then result = result + 1 end end -- Print result print ("Number of values > average is: ", result, "\n"); else print ("Error--input list length is not legal \n"); end
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
مكسر
PAID HACK PuBG
Show current system clock
BasicTablePrinter
Hello 2
Map generator
roulette
lua5.3: ...Desktop/rextester_linux_2.0/usercode/68368288/source.lua:166: unexpected symbol near '}'
PAID HACK PuBG
cumulative probability
Please log in to post a comment.