4,154 views
21 votes
21 votes
Write a program that prompts for a positive integer and prints the factors of all integers from 1 to that input integer. For example, if the user enters the integer 6 then the program will output: 1: 1 2: 1, 2 3: 1, 3 4: 1, 2, 4 5: 1, 5 6: 1, 2, 3, 6 Determine the appropriate loop(s) to use (while loop or for loop) when a task requires looping. Study the tests below to help you understand program behavior. Use the following tests and your own tests to run against your solution in Develop mode. These are the same tests that your solution will be executed against when you submit your work in Submit mode. User input is in bold:

User Alex Kreutznaer
by
2.4k points

1 Answer

14 votes
14 votes
74(Frequency) or 34(frequency)
User WirthLuce
by
3.0k points