1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
steposvetlana [31]
4 years ago
6

Consider the following code segment. for (int a = 0; a < 10; a++) { for (int b = 10; b > a; b--) { System.out.print("#");

} } How many "#" symbols are printed as a result of executing the code segment?
Computers and Technology
1 answer:
Ket [755]4 years ago
6 0

Answer:

55

Explanation:

Given the codes as below:

  1.        for (int a = 0; a < 10; a++)
  2.        {
  3.            for (int b = 10; b > a; b--)
  4.            {
  5.                System.out.print("#");
  6.            }
  7.        }

There are two layer loops in the code. The outer loop (Line 1) will run for 10 iterations by traversing through a = 0 to a=9. However, the inner loop  (Line 3) will run for 10 + 9 +  8 + 7 +...+ 1 = 55 iterations.

Since the print statement is within the inner loop (Line 5) and therefore the number of printed "#" symbols is dependent on the number of iterations of the inner loop. There will be 55 "#" symbols printed.

You might be interested in
What is the term for a problem in your code
Anna71 [15]

Answer:

bug

Explanation:

Bug

a problem in your code

7 0
3 years ago
Read 2 more answers
Explain how using assistive technology can promote healthy emotional and social development. Discuss how you think young childre
adoni [48]

Assistive technology can promote healthy emotional and social development by catering the needs of young children and teens in a faster and easier way when used correctly. When they reach into adulthood, it will be easier for them to access things because they are used to it.

4 0
4 years ago
1. The correct definition of ergonomics is:​
Alecsey [184]

Answer:

I don't know the choices, but the definition is the study of people's efficiency in their working environment.

Explanation:

hope this helps

6 0
3 years ago
When identifying who will send a presentation, what are the two types of audiences? <br>​
Virty [35]

Answer:

Explanation:Demographic audience analysis focuses on group memberships of audience members. Another element of audience is psychographic information, which focuses on audience attitudes, beliefs, and values. Situational analysis of the occasion, physical setting, and other factors are also critical to effective audience analysis.

5 0
3 years ago
This program outputs a downwards facing arrow composed of a rectangle and a right triangle. The arrow dimensions are defined by
skad [1K]

Answer:

Here is the Python program:

arrow_base_height = int(input('Enter arrow base height: \n'))  #prompts user to enter the arrow base height

arrow_base_width = int(input('Enter arrow base width: \n')) #prompts user to enter the arrow base width

arrow_head_width = int(input('Enter arrow head width: \n'))  #prompts user to enter the arrow head width

while (arrow_head_width <= arrow_base_width):  #ensures that the arrow head width is greater than base width

    arrow_head_width = int(input('Enter arrow head width: \n'))  #keeps prompting user to enter arrow head width until the value is larger than the arrow base width.

for i in range(arrow_base_height):  #to print arrow shaft

   for j in range(arrow_base_width):  #iterates through arrow base width

       print ('*', end='')  #prints asterisks

   print ()  #prints new line

for i in range(arrow_head_width):  #iterates through arrow head width arrow head

   for j in range(arrow_head_width-i):  #iterates through arrow head width-i

        print ('*', end='')  #prints asterisks

   print()  #prints new line

       

Explanation:    

The program works as follows:

Suppose user enters 5 as arrow base height, 2 as arrow base width and 4 as arrow head widths so,

arrow_base_height = 5

arrow_base_width = 2

arrow_head_width = 4

Since the arrow_head_width is not less than arrow_base_width so the while loop at the start does not execute. Program control moves to the statement:

for i in range(arrow_base_height):

for j in range(arrow_base_width):

Both of these loop are used to print the shaft line and after execution of these loops the output becomes:

**

**

**

**

**

Note that the outer loop is executed 5 times as arrow_base_height=5 and the inner loop iterates two times for each iteration of outer loop because arrow_base_width is 2 and the print ('*', end='') statement keeps printing the asterisks whereas print() prints a new line after printing 2 asterisks at each line.

Next the program moves to the following loops:

for i in range(arrow_head_width):

   for j in range(arrow_head_width-i):

Both of these loop are used to print the arrow head and after execution of these loops the output becomes:

****

***

**

*

Note that the outer loop is executed 4 times as arrow_head_width=4 and the inner loop iterates 4 times in start and decrements one time at each iteration and the print ('*', end='') statement keeps printing the asterisks whereas print() prints a new line after printing 2 asterisks at each line.

So the entire output of this program is:

**

**

**

**

**

****

***

**

*

The screenshot of the program along with its output is attached.

5 0
3 years ago
Other questions:
  • The trim video feature allows you to trim your clip by time measurements that are accurate to ____ of a second.
    5·1 answer
  • Approximately what percent of desktop PCs are used for work-related purposes?
    13·2 answers
  • Which one of the following words is NOT an action verb?
    10·2 answers
  • What best describes the kinds of online items that are usually protected by copyright law?
    10·1 answer
  • In a folder hierarchy, the top level is referred to as which of the following?
    7·1 answer
  • What were thomas edison's contributions to advances in technology?
    9·1 answer
  • Write the function longest that, given a nonempty list of strings, finds the longest even-length string that ends with ing. It t
    14·1 answer
  • The final wrap-up after the conflict is resolved is called the __________________________.
    8·1 answer
  • Which one???????????????
    14·2 answers
  • When right-clicking an object, a ____ menu appears, which contains frequently used commands related to the object.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!