Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

code so far and the mistakes. please fix Homework 1-3 Textbook Section 5.17 Write a Java program that prompts the user for an int n.

image text in transcribed
code so far and the mistakes. please fix image text in transcribed
image text in transcribed
Homework 1-3 Textbook Section 5.17 Write a Java program that prompts the user for an int n. You can assume that 1 5 should use embedded for loops that produce the following output: 5 9. Your program 21 321 4321 54321 n... 54 3 2 1 Your prompt to the user should be: Please enter a number 1...9: Please note that your class should be named Pattern Two. import java.util.Scanner; class Pattern Two { public static void main(String args[]) Scanner input=new Scanner(System.in); int n=0,i=0,j=0,k=0; System.out.println("Please enter a number 1...9: n=input.nextInt(); for(i=1;ii;j--) System.out.print(" "); for(; j>0;j--) System.out.print(j); System.out.println(); Please enter a number 1...9: Your output 21 321 Please enter a number 1...9: Expected output 4: Compare output A Output is nearly correct; but whitespace differs. See highlights below. Special character in Input 0 number 1...9: Your output N N w N e a number 1.. Expected output 5: Compare output

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning C# 5.0 Databases

Authors: Vidya Vrat Agarwal

2nd Edition

1430242604, 978-1430242604

More Books

Students also viewed these Databases questions