Problem 43141. All odd - all even
All odd numbers in x are added, while all even numers are subtracted from this.
example:
x = [1 2 3 4 5]; y = +(1+3+5)-(2+4) = 3
Solution Stats
Solution Comments
Show commentsProblem Recent Solvers69
Suggested Problems
-
2987 Solvers
-
Given an unsigned integer x, find the largest y by rearranging the bits in x
1791 Solvers
-
The sum of the numbers in the vector
589 Solvers
-
4889 Solvers
-
503 Solvers
More from this Author25
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!