Cody

Solution 1392634

Submitted on 24 Dec 2017 by Dor Greenberg
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
filetext = fileread('MeanWhile.m'); assert(isempty(strfind(filetext, 'regexp')),'regexp hacks are forbidden')

2   Pass
filetext = fileread('MeanWhile.m'); assert(isempty(strfind(filetext, 'sum')),'sum() function is forbidden')

3   Pass
filetext = fileread('MeanWhile.m'); assert(isempty(strfind(filetext, 'mean')),'mean() function is forbidden')

4   Pass
rng(1); av_correct = 5.5; assert(isequal(MeanWhile(),av_correct))

x = 0 y = 0 i = 4 x = 1 y = 4 i = 7 x = 2 y = 11 i = 0 average = 5.5000

5   Pass
rng(2); av_correct = 4; assert(isequal(MeanWhile(),av_correct))

x = 0 y = 0 i = 4 x = 1 y = 4 i = 0 average = 4

6   Pass
rng(3); av_correct = 5.25; assert(isequal(MeanWhile(),av_correct))

x = 0 y = 0 i = 6 x = 1 y = 6 i = 7 x = 2 y = 13 i = 3 x = 3 y = 16 i = 5 x = 4 y = 21 i = 9 x = 5 y = 30 i = 9 x = 6 y = 39 i = 1 x = 7 y = 40 i = 2 x = 8 y = 42 i = 0 average = 5.2500

7   Pass
rng(7); av_correct = 0; assert(isequal(MeanWhile(),av_correct))

x = 0 y = 0 i = 0 average = 0

8   Pass
rng(0); av_correct = 6.571428571428571; assert(isequal(MeanWhile(),av_correct))

x = 0 y = 0 i = 8 x = 1 y = 8 i = 9 x = 2 y = 17 i = 1 x = 3 y = 18 i = 10 x = 4 y = 28 i = 6 x = 5 y = 34 i = 1 x = 6 y = 35 i = 3 x = 7 y = 38 i = 6 x = 8 y = 44 i = 10 x = 9 y = 54 i = 10 x = 10 y = 64 i = 1 x = 11 y = 65 i = 10 x = 12 y = 75 i = 10 x = 13 y = 85 i = 5 x = 14 y = 90 i = 8 x = 15 y = 98 i = 1 x = 16 y = 99 i = 4 x = 17 y = 103 i = 10 x = 18 y = 113 i = 8 x = 19 y = 121 i = 10 x = 20 y = 131 i = 7 x = 21 y = 138 i = 0 average = 6.5714

Suggested Problems

More from this Author25