Odd times even numbers in a matrix
First count the number of odd numbers in x, then the number of even. Return their product.
example:
x = [1 2]
One odd ...
3 years ago
Solved
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)-...
3 years ago
Solved
Count the numbers
In a array x, count the number of times the number n appears in x.
for example: x = [1 2 3 4 3 2 1 2] and n = 2 the answer sh...
3 years ago
Solved
Add the even numbers
Add only the even numbers of x
example:
x = [1 2 3 4 5]
the positive numbers are: 2 4, so their sum is 6
3 years ago
Solved
Add the positive numbers
Add only the positive numbers of x
example:
x = [-2 -1 0 1 2 3]
the positive numbers are: 1 2 3, so their sum is 6