0% found this document useful (0 votes)
33 views1 page

Xmax 10 Sum 0 Numlist 1:xmax Sum Sum + Numlist Disp (Sum)

This code defines a maximum value of 10 and initializes a sum variable to 0. It then uses a for loop to iterate from 1 to the maximum value, adding each iteration's value to the running sum, and displays the sum after each iteration before ending the loop.

Uploaded by

satyam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views1 page

Xmax 10 Sum 0 Numlist 1:xmax Sum Sum + Numlist Disp (Sum)

This code defines a maximum value of 10 and initializes a sum variable to 0. It then uses a for loop to iterate from 1 to the maximum value, adding each iteration's value to the running sum, and displays the sum after each iteration before ending the loop.

Uploaded by

satyam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

xmax = 10;

sum = 0;
for numlist = 1:xmax
sum = sum + numlist;
disp (sum)
end

You might also like