Ask Question
16 August, 00:04

Determine the output of the following code segment:

int i;

int [] numbers = new int [10];

for (i = 0; i < numbers. length; i++)

{ numbers[i] = 2 * (i - 5); numbers[i] = numbers[i] * numbers[i]; }

for (i = 0; i < numbers. length; i++)

{ System. out. println (numbers[i]);

+4
Answers (1)
  1. 16 August, 03:11
    0
    The output to the given code as follows:

    Output:

    10

    100

    64

    36

    16

    4

    0

    4

    16

    36

    64

    Explanation:

    In the given java code, an integer variable "i" and an array number is defined, which size is 10, in the next step two for loop is declared, that can be described as follows:

    In the first loop, array use loop variable "i" use, which minus the value of 5 and multiplies by 2, and it will calculate the square of that number. In the next step, a for loop is declared, that prints these array number variable square.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Determine the output of the following code segment: int i; int [] numbers = new int [10]; for (i = 0; i < numbers. length; i++) { ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers