15 DEC 20 sum all num project

0

15 DEC 20 sum all num project - image 1 - student projectnot pretty but works

 

this would also work

 

function sumAllNumbers(num)

sum = 0
for i = 1, num do
  sum = sum + num
  num = num - 1
end
return sum
end
print("The final sum is: " .. sumAllNumbers(12))