write script( a for loop that multiplies all evens numbers from 2 to 10)

1 次查看(过去 30 天)
Please help

回答(2 个)

Andriy Kavetsky
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

Andrei Bobrov
Andrei Bobrov 2016-10-24
编辑:Andrei Bobrov 2016-10-24

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by