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.

2 views (last 30 days)
S=0;
k=1;
while S>10000
S=(factorial(k-1))/2^(3*k+5);
k=k+1;
end
k

Answers (2)

madhan ravi
madhan ravi on 10 Jan 2019
should be < not >

Steven Lord
Steven Lord on 10 Jan 2019
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.

Categories

Find more on MATLAB in Help Center and File Exchange

Tags

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!