r = 0; for y=1:2:5 r=r+3; end in matlab

main.m
r = 0; 
for y = 1:2:5
    r = r + 3;
end
41 chars
5 lines

In this code, we are initializing the variable r to 0, and then using a for loop to iterate through the values of y from 1 to 5 in increments of 2. Within the loop, we are adding 3 to the variable r each time. After the loop completes, r will contain the final value of 9 (since the loop iterates over the values 1, 3, and 5).

gistlibby LogSnag