Cody

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

Solution 1938973

Submitted on 17 Sep 2019 by Trinh Long
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))

a = 1 y = 1

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

a = 1 a = 3 a = 6 a = 11 y = 11

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

a = 1 a = 3 a = 6 a = 11 y = 11

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

a = 1 a = 3 a = 6 a = 10 a = 15 a = 21 a = 28 a = 36 a = 45 a = 55 a = 66 a = 78 a = 91 a = 105 a = 120 a = 136 a = 153 a = 171 a = 190 a = 210 a = 231 a = 253 a = 276 a = 300 a = 325 a = 351 a = 378 a = 406 a = 435 a = 465 a = 496 a = 528 a = 561 a = 595 a = 630 a = 666 a = 703 a = 741 a = 780 a = 820 a = 861 a = 903 a = 946 a = 990 a = 1035 a = 1081 a = 1128 a = 1176 a = 1225 a = 1275 a = 1326 a = 1378 a = 1431 a = 1485 a = 1540 a = 1596 a = 1653 a = 1711 a = 1770 a = 1830 a = 1891 a = 1953 a = 2016 a = 2080 a = 2145 a = 2211 a = 2278 a = 2346 a = 2415 a = 2485 a = 2556 a = 2628 a = 2701 a = 2775 a = 2850 a = 2926 a = 3003 a = 3081 a = 3160 a = 3240 a = 3321 a = 3403 a = 3486 a = 3570 a = 3655 a = 3741 a = 3828 a = 3916 a = 4005 a = 4095 a = 4186 a = 4278 a = 4371 a = 4465 a = 4560 a = 4656 a = 4753 a = 4851 a = 4950 a = 5050 y = 5050

Suggested Problems

More from this Author95