Write a script that uses a for loop to calculate the product of the negative numbers between -1 and -53, in increments of -4 (−1, −5, · · · , −53).

1 次查看(过去 30 天)
I know how to create the number sequence its just a=(-53:4:-1) but I can't figure out how to multiply all of them together.

回答(1 个)

Walter Roberson
Walter Roberson 2018-1-24
Example:
Number = 1;
for K = 1 : 10
Number = Number * (K*2+1);
end
  4 个评论
Elias Beaini
Elias Beaini 2018-1-24
i don't know how to modify this code to the specific question. i have to compare the results to the prod command and i know how to do that

请先登录,再进行评论。

类别

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