Question: Write a program that prompts the user for an integer and then prints out all of its factors. Remember that a factor is defined as
Write a program that prompts the user for an integer and then prints out all of its factors. Remember that a "factor" is defined as a number that will divide evenly into another number (read: no remainder). Hint: the remainder operator (\%) may be useful. For example, for the number 6 the factors are 1,2,3, and 6 because of the following: 16=623=6 Your program will accept an integer and then print a new line representing each factor found in that integer. Sample Run: Please enter an integer: 100 factor found: 1 factor found: 2 factor found: 4 factor found: 5 factor found: 10 factor found: 20 factor found: 25 factor found: 50 factor found: 100 (program terminates)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
