Cube Every Third Integer Using Nested Loop Structure
Show older comments
Attempting to cube every third integer in an array using a for and if loop structure. Note, this is my first time creating a nested loop structure and need simple straightforward explanation as to why the code does not work.
for i = [1:16]
if (i/3==0)
i^3
else
i
end
end
Answers (1)
Categories
Find more on Loops and Conditional Statements 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!