Cody

Problem 45761. Sum of terms in a series 1 (★★★)

Solution 3477349

Submitted on 30 Oct 2020
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
x = -5; n = 3; y_correct = 8.946043924176486; assert(isequal(your_fcn_name(x,n),y_correct))

x = 5 y = 0 y = 5 y = 7.2361 y = 8.9460

2   Pass
x = 1; n = 10; y_correct = 10; assert(isequal(your_fcn_name(x,n),y_correct))

x = 1 y = 0 y = 1 y = 2 y = 3 y = 4 y = 5 y = 6 y = 7 y = 8 y = 9 y = 10

3   Fail
filetext = fileread('your_fcn_name.m'); assert(isempty(strfind(filetext, 'for')),'for forbidden') assert(isempty(strfind(filetext, 'while')),'while forbidden')

for forbidden

Suggested Problems

More from this Author46

Community Treasure Hunt

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

Start Hunting!