Ask Question
9 March, 21:30

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.

+1
Answers (1)
  1. 9 March, 21:45
    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?
Find 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 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