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
Mila [183]
2 years ago
5

Write a program that uses nested loop or for statements to display Pattern A below, followed by an empty line and then another s

et of loops that displays Pattern B. Once again no setw implementation is allowed here but you must use nested loop or for statements with proper indentation to generate these patterns. Use meaningful variable identifier names, good prompting messages and appropriate comments for each loop segment as well as other sections in the body of your program.
Note: Each triangle has exactly seven rows and the width of each row is an odd number. The triangles have appropriate labels displayed.


Pattern A

+

+++

+++++

+++++++

+++++++++

+++++++++++

+++++++++++++

Pattern B

+++++++++++++

+++++++++++

+++++++++

+++++++

+++++

+++

+
Computers and Technology
1 answer:
JulsSmile [24]2 years ago
8 0

Answer:

public class Pyramid {

   public static void main(String[] args) {

             int h = 7;

       System.out.println("Pattern A");

               for(int i = 1; i <= h; ++i)

               {

                   for(int j = 1; j <= i; ++j) {

                       System.out.print("+");

                   }

                   System.out.println();

               }

       System.out.println();

       System.out.println("Pattern B");

               for (int i = 1; i<=h; ++i)

               {

                 for(int j = h; j >=i; --j){

                     System.out.print("+");

                 }

                   System.out.println();

               }

           }

       }

Explanation:

  • The trick in this code is using a nested for loop
  • The outer for loop runs from i = 0 to the heigth of the triangle (in this case 7)
  • The inner for loop which prints the (+) sign runs from j = 0 to j<=i
  • It prints the + using the print() function and not println()
  • In the pattern B the loop is reversed to start from  i = height
You might be interested in
How does Mixed Reality expand on Augmented Reality?
taurus [48]

Mixed Reality expand on Augmented Reality option d: by enabling real-time interaction between real and virtual objects.

<h3>How does mixed reality expand on augmented reality?</h3>

Mixed reality is known to be one that is made up of both augmented reality and that of augmented virtuality.

Note that Mixed reality is one that acts so as to make an environment with interactive kinds of digital objects. Augmented reality needs a screen to be able to experience the augmented experience. Mixed reality is said to be experienced via the a headset.

Hence, Mixed Reality expand on Augmented Reality option d: by enabling real-time interaction between real and virtual objects.

Learn more about Augmented Reality from

brainly.com/question/9054673

#SPJ1

3 0
2 years ago
To figure out how to use her MacBook Pro graphics software to update designs originally created on a DEC10, Marianne needs to us
mina [271]

Answer:

Glue Language

Explanation:

I'm not 100% sure, but here is the definition.

Glue language- A programming language that can be used to provide interoperability between systems not originally intended to work together

6 0
3 years ago
The diagram shows the parts of a computer. In which part is data processing done?
notsponge [240]
  • control unit mainly processes tasks and most resources are managed here in the computer system.

  • central processing unit, ( CPU ) where most of the data processing is done and executes instructions.
3 0
2 years ago
The control variable of a counter-controlled loop should be declared as ________ to prevent errors. Group of answer choices int
yanalaym [24]

Answer:

int

Explanation:

<h2><u>Fill in the blanks </u></h2>

The control variable of a counter-controlled loop should be declared as  <u>int </u> to prevent errors. Group of answer choices int double float Any of the above.

7 0
2 years ago
I had no computer-related problems.
padilas [110]
Ummmmmmm A, agree???
8 0
3 years ago
Read 2 more answers
Other questions:
  • Assume that you have an array of integers named arr. The following program segment is intended to sum arr [0]through arr[n−1], w
    7·1 answer
  • what is the largest possible number of internal nodes in a redblack tree with black height k? what is the smallest possiblenumbe
    11·1 answer
  • Olivia has developed a great presentation with a distinct purpose and excellent content. She delivered it in a workshop and got
    9·1 answer
  • A service provider, hardware, and web browser are needed to connect to __________.
    8·2 answers
  • A small, electronic chip that a manufacturer develops for use in another product (such as a digital camera or microwave oven) is
    11·2 answers
  • The first step to changing lanes is
    8·2 answers
  • Ava calls tech support because she is unable to send information that a customer has requested. The tech support person tells he
    6·1 answer
  • Presentation software allows users to what ?
    5·2 answers
  • What aspect should you consider before adding pictures to a document?
    8·2 answers
  • How can you stretch or skew an object in paint
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!