Question: Fill in the skeleton below for a program that prompts the user for an integer. The program should then display a triangle of the numbers

Fill in the skeleton below for a program that prompts the user for an integer. The program should then display a triangle of the numbers as shown below. The program should continue prompting for input until the user enters a negative number. The program should end with a Goodbye! message. See below for an example of the program in action. Make sure your code produces the same output as that given in the transcript below. Please note that a correct solution to this problem will NOT make use of any arrays.

Here is a sample transcript of how the program should work.

Input typed by the user is indicated by bold text:

Enter an integer: 3 33 333

Enter an integer: 2 22

Enter an integer: -1 Goodbye!

import java.util.Scanner;

public class Exam2B { public static void main(String[] args)

{ Scanner in = new Scanner(System.in); // your code goes here

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!