write script( a for loop that multiplies all evens numbers from 2 to 10)
조회 수: 3 (최근 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!