76.6k views
7 votes
Consider this C Program C++ Program Java Program or C# Program. It reads integers from the

standard input (until it gets a negative number) and puts them into an array. After that it calls
processArray on the array, and then prints the value that is returned to standard output.
Currently, processArray does not do anything useful - it just returns 0.
You have to change this program so that it finds the number of sequences of consecutive even numbers
that are of length greater than or equal to 3. and returns that number
For example, if these numbers were provided on the standard input
3
36
62
121
66
25
371
661

User Bdemirka
by
5.3k points

1 Answer

8 votes

Answer:

yeah

Step-by-step explanation:

Consider this C Program or Java Program or Python Program. It reads integers from the standard input (until it gets a negative number) and puts them into an array. After that it calls processArray on the array, and then prints the contents of the array on standard output.

Currently, processArray does not modify the array. You have to change this program so that any sequence of two or more consecutive numbers even numbers in the array are removed from the array and replaced with just the first number of the sequence. In other words, in any sequence of even numbers, only the first number is retained and the others are removed. The processArrayfunction/method should modify the array in-place (preferably without creating a new array), and it should return the new length of the modified array

User Ericksonla
by
5.3k points