Problem 45824. Sum of elements of a vector (★★★)
Given any vector x = [x1, x2, x3, ... xn], compute the sum of its elements.
Thus, if x = [ 1 3 -2 5 ], then the sum of its elements is 7.
You cannot use any of the following commands: sum, dot, norm, for, while
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers85
Suggested Problems
-
How to find the position of an element in a vector without using the find function
2800 Solvers
-
Permute diagonal and antidiagonal
495 Solvers
-
Change the first and last diagonal element of the identity matrix to zero
158 Solvers
-
134 Solvers
-
1022 Solvers
More from this Author52
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!