Answered step by step
Verified Expert Solution
Question
00
1 Approved Answer
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;
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
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started