14-Alexandrite
May 23, 2024
Solved
eliminate some values
- May 23, 2024
- 1 reply
- 1406 views

how can I fix this:
if (a )is less than zero the answer should alwyas be zero
You don't need a range variable w !

What your program tried to achieve can be done that way:

The assignment in the first line is mandatory, otherwise you would have to use an else-statement to assign the (positive) value of a[w to the Result vector.
The same effect could be achieved using a boolean expression (a>0) and vectorization:

Prime 10 worksheet attached
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.