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
This is not a question but I am taking a vote of what device most people use​
Xelga [282]

I tend to use a playstation switch. It runs out of data very quickly though, even with the unlimited plan.

5 0
4 years ago
Tamera was responding to a complaint that one of the employees is having problems with the wired network connection on their lap
WARRIOR [948]

Answer:

tamera like from sister sister hehe

Explanation:

sorry i dont know the awnser

3 0
3 years ago
What is open source software? ​
lana [24]

Answer:

Open source software is free, modifiable, and is able to be redistributed. It is beneficial to those wanting  to customize the software to suit their purposes as it can be easily shared and redistributed.

6 0
3 years ago
Your organization's IT department has developed a custom application that reports the hostname of each client that tries to acce
Andrews [41]

Answer:

Configure DC1 to forward name resolution requests to 192.168.3.0

Explanation:

DC1 is configured in order to use forwarders so that they can send unresolvable host name requests to a DNS server at the main office or the head quarters.

This also prevent sending of DNS spoofing attack  to a DNS client

5 0
3 years ago
What indicates that one color is dominating a picture
Sonbull [250]
When the color is mostly on the pic, it means it is dominating the picture.
3 0
3 years ago
Other questions:
  • What Windows Server 2016 feature leverages the storage contained on a network of servers and adds a new level of fault tolerance
    14·1 answer
  • When is a wrecker considered to be an emergency vehicle?
    12·1 answer
  • While accessing mail through the mail command interface, a user sees 5 new messages in his mailbox. Since the second message app
    13·1 answer
  • Design a program that will receive a valid time in the 24-hour format (e.g. 2305) and convert to its equivalent 12-hour format (
    14·1 answer
  • If you filmed a clip in 120fps, how many frames are in a seconds of video.
    13·1 answer
  • Travel agents are market intermediaries who make their living by gathering, organizing, and dispensing information about travel-
    5·1 answer
  • Is the ability to use digital tools for reading communicating and learning online?​
    5·1 answer
  • Write an if statement that prints the message ""The number is not valid"" if the variable distance is outside the range 100 thr
    8·1 answer
  • What will happen when you run this program?
    12·2 answers
  • Write a program that ask a user to input radius of a circle and display circumference of a circle
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!