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

조회 수: 3 (최근 30일)
sothuon thorn
sothuon thorn 2016년 10월 24일
편집: Andrei Bobrov 2016년 10월 24일
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