MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply TodayFind the sum of all the numbers of the input vector x.

Examples:

Input x = [1 2 3 5] Output y is 11

Input x = [42 -1] Output y is 41

7908 correct solutions
2746 incorrect solutions

Last solution submitted on Sep 22, 2014

9 players like this problem

1 Comment

Carlos Pavon
on 16 Jun 2014

Bien Javier

1 Comment

fert
on 22 Feb 2014

y = sum(x)
x=[1 2 3 5]
is not that true, i am confused.

1 Comment

Andrew Newell
on 7 Jun 2013

This solution is just for a laugh - the test suite is pretty weak!

1 Comment

greatordinary
on 3 Mar 2012

there is definitely something wrong with cody.I am getting 'Undefined function 'cody.verifyCode' for input arguments of type 'char'.' for my solution

1 Comment

Jeff
on 1 Feb 2012

Why isn't nansum(x) a solution?

1 player likes this solution

2 Comments

TAB
on 23 Jun 2012

Test for vactor
x = [1 4;3 4]
It will add columns only.

Ozan Gunaydin
2 hours and 47 minutes ago

Problem is finding the sum of all numbers in an input vector, so the test set is correct.

3 Comments