I want to get minimum number of k for the sum of series to be greater than 10000. But I am getting S=0 and k=1 only.

1 次查看(过去 30 天)
S=0;
k=1;
while S>10000
S=(factorial(k-1))/2^(3*k+5);
k=k+1;
end
k

回答(2 个)

madhan ravi
madhan ravi 2019-1-10
should be < not >

Steven Lord
Steven Lord 2019-1-10
Is 0 greater than 10000? If not, MATLAB will never enter the body of your while loop. Your condition is incorrect.
BTW, your title references "sum of series" but there's no summation (other than k = k + 1) in your code. You're probably missing a bit in the first statement in the body of your while loop.

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

标签

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by