Ask Question
3 November, 08:59

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. 3 November, 09:05
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers