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
Natalija [7]
3 years ago
5

Write a Java program that prompts the user for an int n. You can assume that 1 ≤ n ≤ 9. Your program should use embedded for loo

ps that produce the following output: 1 2 1 3 2 1 4 3 2 1 5 4 3 2 1 . . . n . . . 5 4 3 2 1 Your prompt to the user should be: Please enter a number 1...9 : Please note that your class should be named PatternTwo.

Computers and Technology
1 answer:
zlopas [31]3 years ago
8 0

Answer:

Here is the JAVA program:

import java.util.Scanner;  // to take input from user

public class PatternTwo{   //class name

public static void main(String args[]){  //start of main function

Scanner scan = new Scanner(System.in);   // creates Scanner class object

System.out.print("Please enter a number: ");  //prompts user to enter an int n for the number of rows

int n = scan.nextInt();   //reads and scans the value of n from user

int i, j;   //declares two variables to iterate through i  rows and j columns

for (i=1; i<=n; i++){    //outer loop for rows  

for (j=2*(n-i); j>=1; j--){   //inner loop for space between numbers in pattern  

System.out.print(" ");  }   //displays an empty space in the pattern

for (j = i; j >= 1; j--)  { //inner loop for columns  

System.out.print(j+" "); }   //prints the value of j (prints numbers in reverse)

System.out.println();   }   }   }  //prints a new line after printing each row

Explanation:

The program is explained with an example in the attached document.

You might be interested in
A robot worker and a human worker are both vulnerable to
Lady bird [3.3K]

Answer:

fire

Explanation:

4 0
3 years ago
Endnotes are indicated by
V125BC [204]

Answer:

The answer is D because u have the uppercase letter bold

4 0
3 years ago
Read 2 more answers
Electronic ledger that tracks mathematical data
lesya692 [45]
<span>These kinds of systems are usually installed in the cockpits of aircrafts. It is an electronic computer-controlled display system. It is made up of several kinds of systems constituting the whole.  The purpose of such a kind of display is to increase and widen the field of vision and decrease any kind of visual disturbances from the surroundings. The Flight Data Display another constituent of the system constantly updates the pilots with the status of and data related to the flight. This also includes information about the aircraft itself and navigation information too.</span>
7 0
3 years ago
Looking at your Personal Fact Sheet, do you see any areas that may need improvement? In which areas do you have the most room fo
Andrej [43]
In the Church and in the classroom.
4 0
3 years ago
Read 2 more answers
Hisoka is creating a summary document for new employees about their options for different mobile devices. One part of his report
algol13

Hisoka would not include in his document that is Apple users file-based encryption to offer a higher level of security.

<h3>Does Apple use the file based encryption?</h3>

It is said that iOS and iPad OS devices are known to often use a file encryption system known to be Data Protection.

Therefore,  Hisoka would not include in his document that is Apple users file-based encryption to offer a higher level of security.

Hence option A is correct.

Learn more about encryption from

brainly.com/question/9979590

#SPJ1

3 0
2 years ago
Other questions:
  • Airbags only absorb the _____ impact in a crash. initial final mid-stage smallest
    13·1 answer
  • I’m which scenario would someone most likely be using presentation software ?
    6·2 answers
  • Of the following which would be the best data representation for this puzzle in a puzzle class?
    6·1 answer
  • Why is a class called a factory of objects
    11·1 answer
  • Which of the following is NOT contained on the Slide Show toolbar?
    11·2 answers
  • ________ is a process where authentication and permission will be passed on from one system to another, usually across multiple
    14·1 answer
  • Create a PHP page that contains an array of at least 20 movie titles or book titles (your choice). The HTML page should have an
    7·1 answer
  • There are many commercially made household linens found in the?
    7·1 answer
  • Laura is filming a scene in which the subject is sitting with a lit fireplace behind him. The only other source of light in the
    15·1 answer
  • Question:
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!