Question 1 (4 mark) : Implement a program which reads in a series of integers which is input by the user into an array a

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Question 1 (4 mark) : Implement a program which reads in a series of integers which is input by the user into an array a

Post by answerhappygod »

Question 1 4 Mark Implement A Program Which Reads In A Series Of Integers Which Is Input By The User Into An Array A 1
Question 1 4 Mark Implement A Program Which Reads In A Series Of Integers Which Is Input By The User Into An Array A 1 (32.09 KiB) Viewed 19 times
Question 1 (4 mark) : Implement a program which reads in a series of integers which is input by the user into an array and prints it out in reverse order. REQUIREMENTS • The user input is always correct input verification is not required). • Your code must use recursion and array. • The recursion method void printNumber(int[] array, int index) is a recursion one whose arguments are a positive integer array and one integer. The main method prompts the user to enter the number num of an array first, and then to enter the elements of the array myArray. The recursive method printNumber is then called to display the sequence of numbers in reverse order. • Your code must work exactly like the following example (the text in bold indicates the user input). Example of the program output: Example 1: Enter the length of your array: 6 Enter the elements of your array: 1 2 3 4 5 6 Your array in reverse order is: 6 5 4 3 2 1 Example 2: Enter the length of your array: 5 Enter the elements of your array: 2 5 8 12 67 Your array in reverse order is: 67 12 8 5 2
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply