I would go straight to the bank and have it reported along with the police.
Answer: no why huh hmmmmmmm
Explanation:
Answer:
B. i < list.length
Explanation:
This question is terribly worded, but I assume the meaning is which answer will not result in an error if it's used in the while condition of the for loop. The correct answer is b. i < list.length is telling the loop to continue as long as the variable i is less than the length of the array list.
Answers C and D could potentially be valid under certain circumstances, but very unusual. Answer A will give an error as list[list.length] will give an undefined value (assuming this is indeed javascript and not some other languge).
Answer:
Here is the code for a classic C++ program that does it:
--------------------------------------------------------------------------------
#include <iostream>
using namespace std;
int main()
{
int sum = 0;
int n;
cout << "Input 10 numbers: " << endl;
for (int i = 0; i < 10; i++)
{
cin >> n;
sum += n;
}
cout << "Sum of the numbers: " << sum << endl;
}
--------------------------------------------------------------------------------
Explanation:
I'm assuming you know what "include", "using namespace std" and "int main()" do, so I will skip over those.
First, we declare a variable "sum" and initialize it with 0 so we can add numbers to it later.
Then, we declare a variable "n" that will be set as the input of the user.
The "for-loop" will iterate ( go ) from 0 to 9, and will set the value of "n" as the input that is given -> "cin >> n;". After that, we add the value of "n" to the sum variable.
After "i" reaches 9, it will exit the loop and proceed to printing the sum of the numbers.
Hope it helped!