What is the final value of this variable when executed in MATLAB?
Show older comments
Okay so I am supposed to find a final value given the code below. I know how to do it on MATLAB but I don't understand how to do it without MATLAB and apparently I'm supposed to know how to get the final_value without using MATLAB. Code:
i = 3;
j = 2;
k = 4;
final_value = 2;
for i = 1:5
final_value = final_value + 2*i+3*j+k;
end
When I do it in MATLAB i get an answer of 82 (which I'm not sure if it is right), but whether it's right or wrong, how would I get the answer without using matlab?
Accepted Answer
More Answers (0)
Categories
Find more on Variables in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!