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]
3 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]3 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
Which of the following describes a Trojan horse?
HACTEHA [7]

Answer:

the answer is

c. Trojan horses enter a secure space, while an infected file proceeds to be downloaded and run.

7 0
3 years ago
Expand and simplify the following expressions. 1/2 [ 2x + 2 ( x - 3)] *​
Lerok [7]

Answer: 2

x

−

3

Explanation:

4 0
3 years ago
To prevent replay attacks, authentication protocols create a number that will be used only once. The number is called a _____.
fgiga [73]

Authentication protocols are usually designed and configured to create a number that will be used only once, so as to prevent replay attacks in a computer network. Thus, this number is called a <u>nonce</u>.

Authentication work based on the principle of strategically matching an incoming request from an end user or electronic device to a set of uniquely defined credentials.

In an access control list (ACL), authentication and authorization is used to ensure an end user is truly who he or she claims to be, as well as confirming that an electronic device is valid through the process of verification.

In Cybersecurity, authentication protocols are usually designed and configured to create a nonce, which can be used only once, so as to prevent replay attacks in a computer network.

In conclusion, a nonce is used prevent replay attacks in a computer network because the number created by an authentication protocol can be used only once.

Read more: brainly.com/question/17307459

7 0
2 years ago
I haven’t got a response back from Brainly and I emailed them 3 days ago about my account. I was charged for the wrong membershi
Crazy boy [7]

contact an administrator or email their support team. If neither respond, contact Google Play Services and show proof that you did not agree to the app's service

7 0
3 years ago
Read 2 more answers
The cost of a given amount of computing power has _____.
lana [24]

Answer:

decreased drastically over the last five decades

Explanation:

I would say it is that answer because a few decades ago we needed huuuge computers that filled rooms to compute simple tasks. Now we have cellphones, which are basically computers that can fit into the palm of our hands. Our phones can do more than what those huge computers of the past did and they're easier to produce. So cost must have drastically decreased.

3 0
3 years ago
Read 2 more answers
Other questions:
  • In cell R9, enter a formula using the AVERAGEIF function to determine the average number of years of experience for lifeguards.
    12·1 answer
  • Why a management-focused program provides a more appropriate learning path for you than a program based heavily on technical con
    8·1 answer
  • Why does the job market change overtime
    9·1 answer
  • George wants to edit the font of the title text in his presentation. Where can he find the option to edit it?
    6·2 answers
  • Searching for a particular record in a database is called “querying the data.”<br> True<br> False
    9·2 answers
  • Conner has located a research source that is sponsored by a pharmaceutical company. Based on the sponsorship, Conner must be car
    8·1 answer
  • The concept of taking traffic that’s all aimed at the same node and delivering it to the proper receiving service is known as
    8·1 answer
  • You have a technical interview for a new position in digital media. One of the questions you are asked is this: “A client asks y
    13·1 answer
  • How has the widespread shift to remote work caused businesses to reconsider their use of Extended Reality (XR)?.
    13·1 answer
  • Why should you make sure the paper being used in a printer is dry and not damp?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!