Question: Define a method named swap Values that takes an array of four integers as a parameter, swaps array elements at indices 0 and 1, and

 Define a method named swap Values that takes an array of Define a method named swap Values that takes an array of four integers as a parameter, swaps array elements at indices 0 and 1, and swaps array elements at indices 2 and 3. Then write a main program that reads four integers from input and stores the integers in an array in positions 0 to 3. The main program should call function swap Values() to swap array's values and print the swapped values on a single line separated with spaces. Ex: If the input is: 3824 function swap Values() returns and the main program outputs: 8342

Step by Step Solution

3.33 Rating (153 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The detailed ... View full answer

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 Programming Questions!