the following program is supposed to compute only profits (positive earnings) for the first half of the year (6 months). what is logically wrong with the implementation?

Respuesta :

The output will be 1 1 1 2 1 4 6. Hence, the output will be 1 1 2 4 5 1 for the second half.

N = 7, and the price is equal to [100 80 60 70 60 75 85].

1 1 1 2 1 4 6 as output

Explanation: Crossing the input span of 100 will result in the span being 1, 80 being less than 100, 1, 60 being less than 80, 1, 70 being more than 60, 2, and so on. The result will therefore be 1 1 1 2 1 4 6.

N = 6, and the price is equal to [10 4 5 90 120 80].

Results: 1 1 2 4 5 1

Explanation: When traversing the input given, the span for 10 will be 1, since 4 is less than 10 and 5 is greater than 4, and the span for 2 and 3.

Learn more about output here-

https://brainly.com/question/18133242

#SPJ4