Question: 1) Create a 10 element integer array and any other variables you need to write the program. Prompt the user to enter 10 values between
1) Create a 10 element integer array and any other variables you need to write the program. Prompt the user to enter 10 values between -20 and +20 and store them in the array.
2) Next, take the array and using a loop, count the number of even numbers in the array. Hint this can be done with an if statement and the mod (%) function. Print out the number of even values to the screen.
3) Next, take the array and using a loop, count the number of odd numbers in the array. Hint this can be done with an if statement and the mod (%) function. Print out the number of odd values to the screen.
4) Next, take the array and using a loop, print only the positive numbers in the array.
5) Lastly, take the array and using a loop make all of the negative values positive, and all the positive values negative. Print out the newly inverted array.
C PROGRAMMING
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
