
Respuesta :
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.
