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 nothing and simply returns 0. You have to modify it so that it finds the highest odd number in the array and prints that to the standard output. It should return 0 if the array has no odd numbers.
For example, if these numbers were provided on the standard input:
2 5 3 8 -1
When your program is run, it should output
5
(and nothing else).
Leave a Reply