main.m177 chars9 lines
Explanation:
summedvalue
.for
loop starts from 1 and goes up to usernum
.mod
function to check if the current value of i
is odd or not. If it is odd, the value of i
is added to summedvalue
.summedvalue
will contain the sum of all odd values from 1 to usernum
. In this case, it will be 1+3+5 = 9.gistlibby LogSnag