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
GenaCL600 [577]
2 years ago
8

I don't understand how to write code for this in Java using nested for loops only. The official question is: write a program tha

t produces the following hourglass figure using nested for loops?

Computers and Technology
1 answer:
Bingel [31]2 years ago
4 0

Answer:

public class Triangle

{

public static void main( String[] args )

{

show( 5 );

}

public static void show( int n )

{

int i,j,k;

for (i = 0; i < n - 1; i++ )

{

for (j = 0; j < i; j++ )

{

System.out.print( " " );

}

for (k = n - i; k > 0; k-- )

{

System.out.print( "* " );

}

System.out.println();

}

for (i = 0; i < n; i++ )

{

for (j = n - i; j > 1; j-- )

{

System.out.print( " " );

}

for (k = 0; k < i + 1; k++ )

{

System.out.print( "* " );

}

System.out.println();

}

You might be interested in
Technician A says that oil for the rod bearings comes from splash off the crankshaft. Technician B says that lubrication to the
worty [1.4K]

Answer: technician B

Explanation:

The oil is picked up from the oil pump though a pick up tube that is mounted on the oil pump. The end of the pick up tube sits in the oil at the bottom of the oil pan. The oil is then forced through holes that are drilled into the block. Those holes which are called (journals) lead to the main bearings,rod bearings,lifters, camshaft, ect..

7 0
2 years ago
Which sentence describes the right thing to do when the computer doesn’t respond?
PolarNik [594]
3 is correct because if brings you to the lock screen and lets you restart the computer
 1 is wrong because if you disconnect it there is a chance if won't connect and power it anymore.
5 0
2 years ago
Read 2 more answers
How does the CSMA/CD protocol resolve when two network adapters on the same network transmit at the same time?
KengaRu [80]

Answer:

If two network adapters on the same network transmit at the same time, one of the adapters would stop transmitting until the second adapter has finished transmitting before retransmission

Explanation:

Carrier Sense Multiple Access with Collision Detection (CSMA/CD) is a network protocol used to prevent data collision. CSMA/CD detects collisions by sensing transmissions from other nodes. If a collision is detected, the node stops transmitting, sends a jam signal, and then waits for some time until the channel is idle before retransmission.

If two nodes on the network start transmitting at the same time, the nodes will detect the collision and take the appropriate action.

If two network adapters on the same network transmit at the same time, one of the adapters would stop transmitting until the second adapter has finished transmitting before retransmission

4 0
2 years ago
What savings account has the best rate of return on his interest
NeX [460]

Ally.com is a great savings account.

8 0
2 years ago
PLEASE HELP ME ASAP ;(
Pavel [41]

Answer:

It is D

Extra words here

7 0
3 years ago
Other questions:
  • How would this requirement be implemented?
    12·1 answer
  • How to revert a dismissed javascript popup alert box in chrome?
    5·1 answer
  • Using e-mail has decreased the number of hand-written letters that people send to their friends and relatives. this is a ____ fu
    11·1 answer
  • Two boxes overlap if their interiors have at least one point in common. Give an O(n log n)-time algorithm that decides if there
    8·1 answer
  • 25 pts! If programmers cannot write an algorithm because the problem is too complex, which methodology can they use to reach an
    14·1 answer
  • A folder has been shared with other users and set to read-only. What does this mean for users?
    12·2 answers
  • BUURTAIS
    7·1 answer
  • For what purpose is IT used in business?
    7·1 answer
  • Examine about the Internal &amp; External Fragmentation methods give an example for each. essay​
    15·1 answer
  • The average numbers of shares a piece of content receives is known as its:
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!