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
AleksAgata [21]
3 years ago
8

(Display four patterns using loops) Ask the user to enter an integer to

Computers and Technology
1 answer:
fomenos3 years ago
4 0

Answer:

Hi There was small mistake. It is working fine for me. When you run from command line - use LoopPattern, not looppatern

import java.util.Scanner;

public class Looppattern {

  public static void main(String[] args) {

      Scanner sc = new Scanner(System.in);

      System.out.println("Enter how man levels you need: ");

      int levels = sc.nextInt();

      System.out.println("\n---------------Pattern A-----------------\n");

      for (int p = 1; p <= levels; p++) {

          for (int k = 1; k <= p; k++) { // increasing each level printing

              System.out.print(k);

          }

          System.out.println();

      }

      System.out.println("\n---------------Pattern B-----------------\n");

      int r = levels;

      for (int p = 1; p <= levels; p++) {

          for (int k = 1; k <= r; k++) {

              System.out.print(k);

          }

          r--; // decreasing levels

          System.out.println();

      }

      System.out.println("\n---------------Pattern C-----------------\n");

      for (int p = 1; p <= levels; p++) { // here incresing

          for (int k = p; k > 0; k--) { // and here decreasing pattern to

                                          // achieve our required pattern

              System.out.print(k);

          }

          System.out.println();

      }

      System.out.println("\n---------------Pattern D-----------------\n");

      r = levels;

      for (int p = 1; p <= levels; p++) {

          for (int k = 1; k <= r; k++) {

              System.out.print(k);

          }

          r--; // decreasing levels

          System.out.println();

      }

  }

}

Explanation:

You might be interested in
State any three points of importance of local level profession​
melamori03 [73]

Answer:

hello 안녕하세요

Explanation:

mate I tried to write here but it says it's too much writing that why I attached a pic

BTW did u like that☺☺

8 0
3 years ago
What is application software used for
topjm [15]

Applications software (also called end-user programs) include such things as database programs, word processors, Web browsers and spreadsheets. A word processor could be classed as general purpose software as it would allow a user to write a novel, create a restaurant menu or even make a poster.

8 0
4 years ago
Algorithm of how to calculate the area of a square.
USPshnik [31]

Answer:

In order to calculate area of a square, 'A' be the area of square and the length of the square be 'a'. Then we need to calculate A= a*a. Step 2 :- Accept as input, the length of the sides of the square, and store the value in variable a. Step 3 :- Calculate the area of the square (a*a) and store in a variable A.

Explanation:

3 0
3 years ago
Read 2 more answers
Which of the following is something you need to keep an eye out for
Brilliant_brown [7]

Answer:

D. Pedestrians ignoring DON'T WALK signs

Explanation:

Pedestrians ignoring DON'T WALK signs is something you need to keep an eye out for  near packed intersections.

4 0
3 years ago
Read 2 more answers
Craig's annual take-home pay is $75,000. What is the maximum amount that he can spend per month paying off credit cards and loan
kipiarov [429]

$ 75000 is the maximum amount that he can spend per month paying off credit cards and loans and not be in danger of credit overload.

More than this amount will exceed his income.

5 0
3 years ago
Read 2 more answers
Other questions:
  • :If a process terminates, will its threads also terminate or will they continue to run? Explain your answer.
    14·1 answer
  • How should you set the OHMS ADJust control on a multitester of analog VOM, for resistance measurements?
    12·1 answer
  • The CMS Quarterly Provider Update (QPU) is an online CMS publication that contains information about __________ currently under
    14·1 answer
  • How do i delete an account for brainly how do i delete everything
    7·2 answers
  • The printer prints 16 pages every minute. How many pages are printed in 6 minutes?
    14·2 answers
  • Type the correct answer in each box. Spell all words correctly.
    14·2 answers
  • Light the<br> Spark hop<br> Answer if ur a baddie;)))
    9·2 answers
  • You Could Never Size Me UP! Been Doing This Sh*t A Long ⏱time
    15·1 answer
  • Search the Web for three different employee hiring and termination policies. Review each and look carefully for inconsistencies.
    5·1 answer
  • Pie charts are best used for
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!