Question: Write a program that creates an int array of 9. The program should get input from the user to determine actions to perform. Print the

Write a program that creates an int array of 9. The program should get input from the user to determine actions to perform. Print the options each time. User input should be an int and corresponds to the following actions:

0 Quit program

1 Print sum of array

2 Print last element of array

3 Print the number of occurrences of even numbers

4 Swap the first and last element of the array and print the new array

Sample execution using array: 5,7,9,10,12,2,50,2,43 Input will be italicized. Output will be bold.

Select an option.

0 Quit program

1 Print sum of array

2 Print last element of array

3 Print the number of occurrences of even numbers

4 Swap the first and last element of the array and print the new array

1 140 2 43 4 43 7 9 10 12 2 50 2 5 2 5 3 5

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!