Answer:
There is only one modification in the above loop i.e. while loop should be like this--
while (i != n)
{
sum+=arr[i]; // Line 1, In question segment it is line 2.
i++; // Line 2, In question segment it is line 1.
}
Output:
Now if the array input is 1,2,3,4,5 then the output is 15.
Explanation:
In the above question, all the line of the segment is right except the body of the loop because--
- The First line of the loop is increment statement which increments the value of "i" variable from 1 and the value of "i" variable will be 1 in the first iteration of the loop
- The second line starts to add the value from 1'st index position of the array. Hence the segment gives the wrong answer. It adds the arr[1] to arr[n-1].
- So I interchanged both lines of the while loop as shown in the answer part. I make the line 1 (In question segment) as line 2(In answer part) and line 2 (In question segment) as line 1 (In answer part).
Now It gives the correct output because it can add arr[0] to arr[n-1].
telecommunications is just one other term. there's also industrial science or automation
<span>The asthenosphere is a part of the upper mantle just below
the </span>lithosphere<span> <span>that is involved in </span></span>plate tectonic
movement<span> <span>and </span></span>isostatic<span> <span>adjustments. The
lithosphere-asthenosphere boundary is conventionally taken at the 1300 °C </span></span>isotherm<span>, above which the mantle behaves in a rigid fashion and below
which it behaves in a </span>ductile<span> fashion. a</span><span>nd </span>flows very slowly, in a manner<span> similar
to the ice at a bottom of a glacier.</span>
Answer:
Option d pretest
Explanation:
Given the pseudocode:
- do stepA
- do stepB
- if conditionC is true
- then do stepD
- else
- do stepE
- end if
- while conditionF is true
- do stepG
- end while
The pseudocode above shows that there is a pretest before some codes are executed. For example, line 3 check if condition is true then only execute stepD otherwise execute stepE. Line 8 check if conditionF is true then repeatedly execute stepG. These are examples of pretest a condition will must be met (pretest passed) before a block of codes can be executed. This pretest can be seen in if-else statements and also the while condition.