Question: Write a program that accepts an integer limit and an integer value and that prints a complete line of output reporting the multiples of value

Write a program  that accepts an integer limit and an integer value and that prints a complete line of output reporting the multiples of value uptil the limit.  


 

Keep prompting the user for a value and display the multiples until the user presses 'n' or 'N' for No. 


 

Notice that the multiples are separated by commas. You must exactly reproduce this format.  The integer value entered must be greater than or equal to 1.


 

Hint: Use a for loop to calculate and display the multiples and a do while loop to repeat the program


 

Example output:


 

Welcome to the Multiples Program

Enter a number greater than or equal to 1:  3

How many multiples you would like to see :  5

The first 5 multiples of 3 are 3, 6, 9, 12, 15


 

Would you like to find multiples of another number ? Enter Y for yes and N for no :Y

Enter a number greater than or equal to 1:  7

How many multiples you would like to see :  3

The first 3 multiples of 7 are 7, 14, 21


 

Would you like to find multiples of another number ? Enter Y for yes and N for no :Y

Enter a number greater than or equal to 1:  0

Number must be greater or equal to 1     :  2

How many multiples you would like to see :  5

The first 5 multiples of 2 are 2, 4, 6, 8, 10


 

Would you like to find multiples of another number ? Enter Y for yes and N for no :N

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Below is a Java program that fulfills the requirements you provided It prompt... View full answer

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 Programming Questions!