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].
People do have reasons why they want to work for a particular company. It may be due to what they company stands for, what they make or about your dream.
I can therefore say that I want to work for Rev because they are revolutionizing the industry and I want to be part of the change process.
<h3>How do you answer why do you want to work?</h3>
Note that when looking for a job, job experience do matter. When ask the reason for looking for this job.
One can answer that they have the experience or the needed expertise and skills required for this job as they want to be aligned with what the company stands for.
Learn more about work from
brainly.com/question/25573309
Answer:
c.B2b digital transaction
Explanation:
yan lang po sana makatulong
Answer:
Explanation:
The following code is written in Java and creates the recursive function to find the longest common substring as requested.
static int lengthOfLongestSubsequence(String X, String Y) {
int m = X.length();
int n = Y.length();
if (m == 0 || n == 0) {
return 0;
}
if (X.charAt(m - 1) == Y.charAt(n - 1)) {
return 1 + lengthOfLongestSubsequence(X, Y);
} else {
return Math.max(lengthOfLongestSubsequence(X, Y),
lengthOfLongestSubsequence(X, Y));
}
}
It’s a making sections about what algorithms to use