For loop comand use

2 views (last 30 days)
F.O
F.O on 5 Oct 2017
Commented: F.O on 6 Oct 2017
Hi,I want to compute the sum 2 + 4 + 6 + 8 + 10 + : : : + 100 by using For loop . Can anyone here thankfully help me out?
  4 Comments
F.O
F.O on 6 Oct 2017
I have changed it and got correct answer. Thanks

Sign in to comment.

Accepted Answer

James Tursa
James Tursa on 5 Oct 2017
The general outline of your for loop would be:
total = 0;
for k=start_value:increment:end_value % <-- you fill in the start_value, increment, and end_value
total = total + something; % <-- you fill in the something
end

More Answers (0)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!