Question

2.) In order to have a loop that allows the user to input 10 values, what...

2.) In order to have a loop that allows the user to input 10 values, what would be entered in the blank below:
int counter = _________;
while (counter < 10)
{
inputVal = Console.ReadLine();
++counter;
}

3.)What is produced from the following code segment?
for (int i = 1; i < 5; i++) WriteLine(i);

Nothing is displayed

Outputs 5 thru 9

Outputs 10

Outputs 1 thru 4

Outputs 1 thru 5

Outputs 10 thru 14

Outputs 0 thru 4

4.)

Assuming val was described as an integer and an initial value of 10, what is produced from the following code segment?
while (val < 10) WriteLine(val);

Nothing is displayed

Outputs 5 thru 9

Outputs 10

Outputs 1 thru 4

Outputs 1 thru 5

Outputs 10 thru 14

Outputs 0 thru 4

5.)

What is produced from the following code segment?
for (int val = 5, endVal = 10; val < endVal; val++) WriteLine(val);

Nothing is displayed

Outputs 5 thru 9

Outputs 10

Outputs 1 thru 4

Outputs 1 thru 5

Outputs 10 thru 14

Outputs 0 thru 4

6.) What is produced from the following code segment?
for (int n = 0; n < 5; n++) WriteLine(n);

Nothing is displayed

Outputs 5 thru 9

Outputs 10

Outputs 1 thru 4

Outputs 1 thru 5

Outputs 10 thru 14

Outputs 0 thru 4

7.)

What is produced from the following code segment?
val = 0; do { WriteLine(val); val++; } while (val < 5);

Nothing is displayed

Outputs 5 thru 9

Outputs 10

Outputs 1 thru 4

Outputs 1 thru 5

Outputs 10 thru 14

Outputs 0 thru 4

8.)

In order to have a loop that adds odd values from 10 through 20, what would be entered in the blanks below:
int oddAccumulator = 0;
for (int i = _____(need to answer)______; i < _____(need to answer)_________; i++)
{
if ((i % 2) != 0)
{
oddAccumulator += ______(needs an answer)_____;
}
}
WriteLine("The sum of odd integers in the range of 10 - 20 is: {0} ", oddAccumulator);

Homework Answers

Answer #1

2.ANSWER:

int counter = 0;

3.ANSWER:

   Output: 1 to 4

4.ANSWER:

   Nothing is displayed

5.ANSWER:

Output: 5 to 9

6.ANSWER:

   Output: 0 to 4

7.ANSWER:

    Output: 0 to 4

8.ANSWER:

int oddAccumulator = 0;
for (int i = 10; i <20; i++)
{
if ((i % 2) != 0)
{
oddAccumulator += i;
}
}
WriteLine("The sum of odd integers in the range of 10 - 20 is: {0} ", oddAccumulator);

if you have any queries regarding answers ,please ask me at comment section.

please give like.

thank you.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
1.) In order to have a loop that adds odd values from 10 through 20, what...
1.) In order to have a loop that adds odd values from 10 through 20, what would be entered in the blanks below: int oddAccumulator = 0; for (int i = [a]; i < [b]; i++) { if ((i % 2) != 0) { oddAccumulator += [c]; } } WriteLine("The sum of odd integers in the range of 10 - 20 is: {0} ", oddAccumulator); *I've figured out the answer for [a] = 10, [b] = 20, but I can't...
JAVA / I KNOW THERE IS MORE THAN ONE QUESTION BUT THEY ARE SO EASY FO...
JAVA / I KNOW THERE IS MORE THAN ONE QUESTION BUT THEY ARE SO EASY FO YOU I NEED YOUR HELP PLEASE HELP ME. I WILL GIVE UPVOTE AND GOOD COMMENT THANK YOU SO MUCH !!! QUESTION 1 What is the output after the code executes? Assume there are no syntax errors and the code will compile. int x = 10; do { System.out.println ( x ); x -= 3; } while (x > 0); A. 10 7 4 1...
1. The conditon of a "while" loop and a "for" loop are executed at the ____________...
1. The conditon of a "while" loop and a "for" loop are executed at the ____________ of these loops. 2. What will the following code fragment print?    for (i = 0; i < 4; i++)        cout << i + 1; cout << i; 3. What is the result in answer below? int int1=16; int int2=5; int answer=0; answer = int1 / int2 + (5 * 2);
4.2.2 Basic while loop with user input. JAVA Write an expression that executes the loop while...
4.2.2 Basic while loop with user input. JAVA Write an expression that executes the loop while the user enters a number greater than or equal to 0. Note: These activities may test code with different test values. This activity will perform three tests, with user input of 9, 5, 2, -1, then with user input of 0, -17, then with user input of 0 1 0 -1. See "How to Use zyBooks". Also note: If the submitted code has an...
C - Language Write an expression that executes the loop while the user enters a number...
C - Language Write an expression that executes the loop while the user enters a number greater than or equal to 0. Note: These activities may test code with different test values. This activity will perform three tests, with user input of 9, 5, 2, -1, then with user input of 0, -17, then with user input of -1. Also note: If the submitted code has an infinite loop, the system will stop running the code after a few seconds,...
(Java) For the following code segment, match the different values of the empty line with the...
(Java) For the following code segment, match the different values of the empty line with the resulting Big O complexity of the algorithm. int n = int k = 0; for (int i=0; i <= n; i++){ int j = i; while (j > 0) { // ___MISSING CODE___ k++; } } j = 0; j--; j /= 2; j = j * 2; Options for each are: O(n^3)            O(n * log n)            an...
This is an exercise using a while loop Input an integer n from the keyboard. Calculate...
This is an exercise using a while loop Input an integer n from the keyboard. Calculate the sum of the first n integers. So if n=10, the answer should be 55 (because 1+2+3+4+5+6+7+8+9+10=55) Code language: Java
In Java programming language 11.Create the code for a for loop to print the numbers 1  through...
In Java programming language 11.Create the code for a for loop to print the numbers 1  through 5 inclusive vertically so the output is 1 2 3 4 5 11b What is the output of the following               OUTPUT int i=3; while(int i >0) { System.out.println(i); i--; } 11c What is the output of the following               OUTPUT for(int i=3;i<10;i++) System.out.println(3*i); 11d Create the line of code to print the numbers 10 through 1 decreasing by 1 each time 11e Create the line of code...
1. How many times the loop below will be executed? What is the value of variable...
1. How many times the loop below will be executed? What is the value of variable counter after the loop? counter = 1 while counter < 7: counter+=2 print(counter) 2. An integer is stored in a variable MyInt. Write the Python if statement to test if MyInt is even number or odd number, and print a message to show “It is even number.” or “It is an odd number”. 3. Complete the python below that asks user to enter the...
q : explain the code for a beginner in c what each line do Question 2....
q : explain the code for a beginner in c what each line do Question 2. The following code defines an array size that sums elements of the defined array through the loop. Analyze the following code, and demonstrate the type of error if found? What we can do to make this code function correctly ? #include <stdio.h> #define A 10 int main(int argc, char** argv) { int Total = 0; int numbers[A]; for (int i=0; i < A; i++)...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT