I am currently trying to make a column array out of the different values that are produced during a while loop. A new value of n is computed each time the loop executes. Now how can I put all those values into a column array?
1 次查看(过去 30 天)
显示 更早的评论
n = input('Integer');
i = 1;
while n ~= 1;
if mod(n,2) == 0;
n = n/2;
else
n = 3*n + 1;
end
i = i + 1;
end
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!