Cody

Solution 1538105

Submitted on 23 May 2018 by reema ziada
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))

a = 4 m = 4 a = 7 m = 11 a = 0 average = 5.5000

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

a = 4 m = 4 a = 0 average = 4

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

a = 6 m = 6 a = 7 m = 13 a = 3 m = 16 a = 5 m = 21 a = 9 m = 30 a = 9 m = 39 a = 1 m = 40 a = 2 m = 42 a = 0 average = 5.2500

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

a = 0 average = 0

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

a = 8 m = 8 a = 9 m = 17 a = 1 m = 18 a = 10 m = 28 a = 6 m = 34 a = 1 m = 35 a = 3 m = 38 a = 6 m = 44 a = 10 m = 54 a = 10 m = 64 a = 1 m = 65 a = 10 m = 75 a = 10 m = 85 a = 5 m = 90 a = 8 m = 98 a = 1 m = 99 a = 4 m = 103 a = 10 m = 113 a = 8 m = 121 a = 10 m = 131 a = 7 m = 138 a = 0 average = 6.5714