Write a method called printFactors that accepts an integer as its parameter and uses a fencepost loop

Question:

Write a method called printFactors that accepts an integer as its parameter and uses a fencepost loop to print the factors of that number, separated by the word "and ". For example, the factors of the number 24 should print as the following:

1 and 2 and 3 and 4 and 6 and 8 and 12 and 24

You may assume that the parameter’s value is greater than 0, or you may throw an exception if it is 0 or negative.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: