Cody

Solution 1450897

Submitted on 27 Feb 2018 by shimon zusmanovsky
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))

s = 0 counter = 0 a = 4 s = 4 counter = 1 a = 7 s = 11 counter = 2 a = 0 average = 5.5000

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

s = 0 counter = 0 a = 4 s = 4 counter = 1 a = 0 average = 4

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

s = 0 counter = 0 a = 6 s = 6 counter = 1 a = 7 s = 13 counter = 2 a = 3 s = 16 counter = 3 a = 5 s = 21 counter = 4 a = 9 s = 30 counter = 5 a = 9 s = 39 counter = 6 a = 1 s = 40 counter = 7 a = 2 s = 42 counter = 8 a = 0 average = 5.2500

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

s = 0 counter = 0 a = 0 average = 0

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

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

Suggested Problems

More from this Author25