Question: In Java, ( Display pyramid upside down ) Write a program that prompts the user to enter an integer from 1 to 1 5 and
In Java, Display pyramid upside down Write a program that prompts the user to enter an integer from to and displays a pyramid. My code isn't working and was wondering if someone could fix it:
package chapterex;
import java.util.Scanner;
public class ChapterEx
public static void mainString args
Scanner input new ScannerSystemin;
System.out.printEnter a number between : ;
int numberOfLines input.nextInt;
int i;
int j;
int k;
int x;
boolean b true;
for int rows ; rows numberOfLines; rows
for i x; i ; i
for j i; j ; j
for k ; k x i && b; k
System.out.print;
if x && j && b
for k ; k x j; k
System.out.print;
if x && j && b
for k ; k x ; k
System.out.print;
System.out.printj ;
b false;
for j ; j i ; j
System.out.printj ;
System.out.println;
b true;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
