write script( a for loop that multiplies all evens numbers from 2 to 10)
5 次查看(过去 30 天)
显示 更早的评论
回答(2 个)
Andriy Kavetsky
2016-10-24
x=2:10;
x=x(mod(x,2)==0)
res=1;
s=size(x)
for i=1:s(1) for j=1:s(2)
res=res*x(i,j);
end
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!