Ask Question

Create a static method called fillarray, which takes an integer array as an input parameter, along with an integer initial value. it should then fill the array with values starting from the initial value, and counting up by 1s. for example, if the data array has length 5, and if the initialvalue is 3, then after execution the array should hold this sequence: 3 4 5 6 7.

+3
Answers (1)
  1. 23 March, 17:45
    0
    Public static void fillarray (int[] theArray, int initValue)

    {

    for (int i = 0; i < theArray. length; i++)

    theArray[ i ] = initValue++; / / make sure you understand what's happening!

    }
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Create a static method called fillarray, which takes an integer array as an input parameter, along with an integer initial value. it should ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers