Question
Given the an array of integers, you will build an function that will multiply each one times 2 and then return the array back to
Given the an array of integers, you will build an function that will multiply each one times 2 and then return the array back to the main method and output it.
1. In your main method, declare and define an array of at least 5 integer elements.
a. For this one problem, the array should be hard-coded and not from user prompted values.
2. Create a function that receives this array of ints.
3. Create a loop to cycle through the array and multiply each element by 2.
a. Remember this loop must work for an array of any size!
b. You must NOT hard coding it!
4. Return this doubled array to the main method.
5. Output both the original and doubled array in the main method. NOT in the custom function.
a. You may use a loop to output the arrays or you may convert them to a string and output that.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started