Cody

# Problem 3. Find the sum of all the numbers of the input vector

Solution 3022966

Submitted on 1 Oct 2020 at 20:17
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 = 1; y_correct = 1; assert(isequal(vecsum(x),y_correct))

sum = 0 sum = 1 y = 1

2   Fail
x = [1 2 3 5]; y_correct = 11; assert(isequal(vecsum(x),y_correct))

sum = 0 sum = 1 sum = 0 sum = 2 sum = 0 sum = 3 sum = 0 sum = 5 y = 5

Assertion failed.

3   Fail
x = [1 2 3 5]; y_correct = 11; assert(isequal(vecsum(x),y_correct))

sum = 0 sum = 1 sum = 0 sum = 2 sum = 0 sum = 3 sum = 0 sum = 5 y = 5

Assertion failed.

4   Fail
x = 1:100; y_correct = 5050; assert(isequal(vecsum(x),y_correct))

sum = 0 sum = 1 sum = 0 sum = 2 sum = 0 sum = 3 sum = 0 sum = 4 sum = 0 sum = 5 sum = 0 sum = 6 sum = 0 sum = 7 sum = 0 sum = 8 sum = 0 sum = 9 sum = 0 sum = 10 sum = 0 sum = 11 sum = 0 sum = 12 sum = 0 sum = 13 sum = 0 sum = 14 sum = 0 sum = 15 sum = 0 sum = 16 sum = 0 sum = 17 sum = 0 sum = 18 sum = 0 sum = 19 sum = 0 sum = 20 sum = 0 sum = 21 sum = 0 sum = 22 sum = 0 sum = 23 sum = 0 sum = 24 sum = 0 sum = 25 sum = 0 sum = 26 sum = 0 sum = 27 sum = 0 sum = 28 sum = 0 sum = 29 sum = 0 sum = 30 sum = 0 sum = 31 sum = 0 sum = 32 sum = 0 sum = 33 sum = 0 sum = 34 sum = 0 sum = 35 sum = 0 sum = 36 sum = 0 sum = 37 sum = 0 sum = 38 sum = 0 sum = 39 sum = 0 sum = 40 sum = 0 sum = 41 sum = 0 sum = 42 sum = 0 sum = 43 sum = 0 sum = 44 sum = 0 sum = 45 sum = 0 sum = 46 sum = 0 sum = 47 sum = 0 sum = 48 sum = 0 sum = 49 sum = 0 sum = 50 sum = 0 sum = 51 sum = 0 sum = 52 sum = 0 sum = 53 sum = 0 sum = 54 sum = 0 sum = 55 sum = 0 sum = 56 sum = 0 sum = 57 sum = 0 sum = 58 sum = 0 sum = 59 sum = 0 sum = 60 sum = 0 sum = 61 sum = 0 sum = 62 sum = 0 sum = 63 sum = 0 sum = 64 sum = 0 sum = 65 sum = 0 sum = 66 sum = 0 sum = 67 sum = 0 sum = 68 sum = 0 sum = 69 sum = 0 sum = 70 sum = 0 sum = 71 sum = 0 sum = 72 sum = 0 sum = 73 sum = 0 sum = 74 sum = 0 sum = 75 sum = 0 sum = 76 sum = 0 sum = 77 sum = 0 sum = 78 sum = 0 sum = 79 sum = 0 sum = 80 sum = 0 sum = 81 sum = 0 sum = 82 sum = 0 sum = 83 sum = 0 sum = 84 sum = 0 sum = 85 sum = 0 sum = 86 sum = 0 sum = 87 sum = 0 sum = 88 sum = 0 sum = 89 sum = 0 sum = 90 sum = 0 sum = 91 sum = 0 sum = 92 sum = 0 sum = 93 sum = 0 sum = 94 sum = 0 sum = 95 sum = 0 sum = 96 sum = 0 sum = 97 sum = 0 sum = 98 sum = 0 sum = 99 sum = 0 sum = 100 y = 100

Assertion failed.

### Community Treasure Hunt

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

Start Hunting!