This is code
for i = 1 : 5
b = i;
a=cumsum(b);
end
fprintf('%f \n', a);
I expected 1 + 2 + 3 + 4 + 5 = 15 so I would print 15 at the end.
But it output 5.000000.
If i code "a = cumsum (b)" outside the for loop, it will not be calculated
How can I get the value I want 1 + 2 + 3 + 4 + 5?
Thanks you