An array of integers named parkingTickets has been declared and initialized to the number of parking tickets given out by the city police each day since the beginning of the current year.
Explanation:
- A variable named ndays has been declared and initialized to hold the size of the array.
- The first element of the array contains the number of tickets given on January 1; the last element contains the number of tickets given today.
- A variable named mostTickets has been declared, along with a variable k.
- If today were January 18, ndays would have the value 18; if today were February 3, ndays would have the value 34
mostTickets=0;
for (k=0; k< ndays; k++)
{
if (parkingTickets[k]>mostTickets) mostTickets=parkingTickets[k];
}
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].
The scripter as he made the script.
Answer: B. hummer
Explanation:
Given the array :
Given the arra
("explorer", "testa", "hummer", "corvette", "civic", "mustang")
Array indexing usually begins from 0
That is ; the first element in the array is indexed as being in position 0
Using the given array as an example :
Index ____ element
0 ______ explorer
1 _______ tester
2 _______hummer
3 _______ corvette
4 _______ civic
5 _______ mustang
Hence, element in index 2 of the array is hummer
Wheels should be pointing towards the curb. this is in case your vehicle rolls, if it does, the wheel will hit the curb and stop the car, it will also prevent the car from going into the road and incoming traffic. vice versa when parking uphill, point wheels away from curb, that is also to prevent the car from rolling to incoming traffic.