Cody

# Problem 44455. Find the average of a random sequance

Solution 1542799

Submitted on 29 May 2018 by Lenny Gorodetsky
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))

elemnts = 0 smmation = 4 a = 7 smmation = 11 a = 0

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

elemnts = 0 smmation = 4 a = 0

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

elemnts = 0 smmation = 6 a = 7 smmation = 13 a = 3 smmation = 16 a = 5 smmation = 21 a = 9 smmation = 30 a = 9 smmation = 39 a = 1 smmation = 40 a = 2 smmation = 42 a = 0

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

elemnts = 0

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

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

### Community Treasure Hunt

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

Start Hunting!