Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

Below is a Java program that fulfills the requirements you provided It prompt... 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

Java An Introduction To Problem Solving And Programming

Authors: Walter Savitch

8th Edition

0134462033, 978-0134462035

More Books

Students also viewed these Programming questions

Question

How does a computers main memory differ from its auxiliary memory?

Answered: 1 week ago