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 program will convert a set of temperatures from Fahrenheit to Celsius and Kelvin. Your program will be reading in three dou
Naily [24]

Answer:

see explaination

Explanation:

#include<iostream>

#include<iomanip>

using namespace std;

int main()

{

double temp1,temp2,inc,cel;

int i=1;

while(i==1)

{

i=0;

cin>>temp1>>temp2>>inc;

if(temp2<temp1||inc<=0)

{

i=1;

cout<<"Starting temperature must be <= ending temperature and increment must be >0.0\n";

}

}

cout<<endl;

cout<<setw(15)<<"Fahrenheit"<<setw(15)<<"Celsius";

while(temp1<=temp2)

{

cel=(temp1-32)/1.8;

cout<<endl;

cout<<fixed<<setprecision(3)<<setw(15)<<temp1<<setw(15)<<cel;

temp1+=inc;

}

}

Please kindly check attachment for output.

8 0
3 years ago
How would you reduce or minimize the size of a "file"?
beks73 [17]
The answer is D Compress

I hope this helps
6 0
3 years ago
14. How do digital libraries address the problem of digital exclusion?
loris [4]

The digital libraries address the problem of digital exclusion by: They reach out to people who need technology and help teach them digital literacy skills.

<h3>What does it mean to be digitally excluded?</h3>

The  digital exclusion  is known to be also as digital divide and this is known to be where a part of the population is known to possess a continuous and unequal access and capacity in regards to the use Information and Communications Technologies (ICT),

Note that IT are very essential for all to be fully participated  in the society and the digital libraries address the problem of digital exclusion by: They reach out to people who need technology and help teach them digital literacy skills.

Learn more about digital exclusion from

brainly.com/question/7478471

#SPJ1

3 0
1 year ago
Find the quotient and the remainder of 11010111 ÷ 1010, assuming that the binary numbers are signed integers in two's complement
andrew-mc [135]

Answer:

Answered

Explanation:

(11010111)_2= -32+8+2+1 = -21

value of 21 = (010101)_2

(100111)_2= -32+4+2+1= -24

value of 25 = (011001)_2

-21\times -25 = 525

525 = (001000001101)_2

5 0
3 years ago
Because of the abundance of water on planet Earth, hydrogen gas (H2) is a candidate in the search for a replacement for petroleu
Dennis_Churaev [7]

The reason why plants are considered to be one step ahead in the utilization of hydrogen as an alternative fuel source is because; Plant cells possess water-splitting enzymes

<h3>What are splitting Enzymes?</h3>

Splitting Enzyme’s are like aldolases that catalyze the conversion of a molecule into two smaller molecules without the addition or removal of any atoms.

Now in plant biology, plants make use of he light-driven water-splitting/oxygen-evolving enzyme known as Photosystem II in photosynthesis to split water.

Read more about splitting enzymes at; brainly.com/question/14713715

3 0
2 years ago
Other questions:
  • Signing up for a(n) ____ will automatically provide you with web content that is updated on a regular basis.
    15·1 answer
  • Create a class named Console, and move all the methods that retrieve and validate user input to that class. These methods can re
    7·1 answer
  • Which hardware device connects your network to the internet? select one:
    15·1 answer
  • Cloud computing is an old phenomenon in computing infrastructure dating back to the early days of the Internet that involves mov
    10·1 answer
  • Assert statements are a tool programmers employ to help them debug their code more efficiently.
    6·1 answer
  • Edhesive in JAVA Write a method that takes a String parameter. If the String has a double letter (i.e. contains the same letter
    13·1 answer
  • Write a program that removes all non-alphabetic characters from the given input.
    7·1 answer
  • What is keyword density?
    15·2 answers
  • A user generates printouts consisting of several pages of seemingly random characters every time he prints to a network printer.
    5·1 answer
  • Which native windows application allows you to access basic pc settings and controls such as system information, controlling use
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!