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
Which of these engine components forms a tight seal between the piston and the cylinder and is necessary for proper engine opera
TEA [102]
<h2>Piston rings help form a tight seal between the piston and cylinder.   Answer is A. Piston ring</h2>
5 0
3 years ago
Read 2 more answers
Assume that name has been declared suitably for storing names (like "amy" , "fritz" and "moustafa") write some code that reads a
tamaranim1 [39]
Name = "Bob"
# or you can prompt the user to enter their name:
# name = input("What's your name? ")

print("greetings," , name)
3 0
4 years ago
How do i unblock a website on a school computer if a school blocks it?
tresset_1 [31]

Answer:

look up ultrasurf and just follow the thingy and it will download a vpn ive had it on my computer for a fat min

Explanation:

4 0
2 years ago
Analyze the following code.
denis-greek [22]

Answer:

C

Explanation:

No explanation, self-explanatory. I used class main instead...

4 0
4 years ago
When using an online media source, students should ensure the information is
OLEGan [10]
Viable and true. hope this helps!
6 0
3 years ago
Read 2 more answers
Other questions:
  • After doing the route tracing to a particular IP addresses, paste the path of IP addresses that were taken from your IP address
    13·1 answer
  • Are we too dependent on technology if yes then can you please explain?
    12·2 answers
  • Technological _____ is the term used to describe the merging of several technologies into a single device.
    13·1 answer
  • What kind of website uses keywords to locate content?
    15·1 answer
  • Imagine that you have a friend who has expressed interest in designing and programming video games. He loves to play video games
    10·1 answer
  • High level languages are closer to machine language than humans yes or no​
    12·2 answers
  • A brick has a weight of 23N. The brick is flat and smooth on the side in contact with the floor having measurements ( height= 5c
    13·1 answer
  • Write a description of the photograph to someone who cannot see the photograph. Be sure to include the title of the photograph a
    5·1 answer
  • Are there any Potential Dangers in Artificial Intelligence?
    11·2 answers
  • Suppose we used an internet addressing protocol that used 4 bits to encode a single address. How many devices would be supported
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!