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
Where or what website can I download anime's? For free ​
Artemon [7]

<em>https://todo-anime.com/</em>

5 0
2 years ago
JAVVVAAAAAA HELPPPP EDHESIVE ​
Mekhanik [1.2K]

Answer:

Here's some really bad code that works:

public static double average(int a, int b, int c, int d, int e)

{

return (((double)a + b + c + d + e) / 5);

}

5 0
3 years ago
Gwen wants to adjust columns of text that contain money values. Which tab stop option should she choose?
Shtirlitz [24]

Gwen wants to adjust columns of text that contain money values. The tab in excel in the stop option that should she choose is: "The decimal Tab" (Option C)

<h3>

What is the Decimal Tab?</h3>

A Decimal Tab stop is used to align numbers around a decimal point. The decimal point remains in the same location regardless of the amount of digits.

When using this form of tab stop, the numbers must be aligned around a decimal character.

Learn more about excel:
brainly.com/question/25879801
#SPJ1

3 0
9 months ago
Many web browsers include _____ tools to make it easier for designers to locate the source of a style that has been applied to a
larisa86 [58]

Answer:

Developer tools.

Explanation:

The main aim of developer tools to loading the HTML(hypertext markup language), CSS and JavaScript it describes how much time takes the page to load in the web browser.

The developer tools make the task easier for the designer to locate the source code which is applied to a specific page element.​We can easily see the source code of the particular website by using the Developer tools. So it makes the task easier for programmers and developers.

4 0
3 years ago
I really need help with this question! Please help!
Pachacha [2.7K]

Explanation:

the third answer is correct

4 0
2 years ago
Read 2 more answers
Other questions:
  • _ is a model of computing in which computer processing, storage, software, and other services are provided as a shared pool of v
    10·1 answer
  • Jackie is planning a birthday party for her little brother and is researching different trampoline parks. She receives a pop-up
    12·2 answers
  • The benefits of flextime include:
    11·2 answers
  • How to do pseudocode and flowchart in BMI ( computer programming ​
    11·1 answer
  • Harry Potter and his friends are at Ollivander's with Ron, finally replacing Charlie's old broken wand. Hermione decides the bes
    11·1 answer
  • Pleases Help ME An example of a _________________ impact is when a product is back ordered and the business contacts the custome
    5·1 answer
  • it is used to hold screws, jumpers, fasteners, and other small parts and prevent them from getting mixed together​
    15·2 answers
  • In the second example with modulus math, why can't Eve find the solution?
    10·1 answer
  • Universal Containers wants to use a sandbox with real data in it. Which Sandboxes three would you recommend?
    11·1 answer
  • An end-user license agreement protects _____.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!