Ask Question
22 September, 21:16

Suppose list is a one dimensional array of size 25, where in each component is of type int. Further, suppose that sum is an int variable. The following for loop correctly finds the sum of the elements of list.

+3
Answers (1)
  1. 22 September, 21:51
    0
    False is the correct answer to the following question.

    Explanation:

    In the following question there some information is missing code is missing which is 'sum = 0;

    for (int i = 0; i < 25; i++)

    sum = sum + list;

    (T/F) '

    The following code is incorrect because this is not the right way to add the elements of an array, the correct code is:

    int sum=0;

    for (int i = 0; i < 25; i++)

    {

    sum = sum + list[i];

    }

    In the following code block, we add each elements of an array and the addition is save into the variable "sum"

    So, that's why the following code is incorrect.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Suppose list is a one dimensional array of size 25, where in each component is of type int. Further, suppose that sum is an int variable. ...” 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