Problem: Given 20 positive integers as input, calculate the number of divisors for each integer and sort the data set from smallest to largest based on the number of divisors. When multiple integers have the same number of divisors then sort them smallest to largest. Examples: Integer value 12 has divisors 1, 2, 3, 4, 6, 12 for a total of 6. Prime numbers only have divisors of 1 and the number itself. The integer 1, the smallest value that will be provided as input, has only a single divisor, itself. Example Execution #1: Enter 20 integer values -> 21 15 10 6 3 1 28 13 5 7 9 29 31 37 17 19 12 43 24 2 Data sorted by number of divisors: 1 2 3 5 7 13 17 19 29 31 37 43 9 6 10 15 21 12 28 24 Example Execution #2 (data does not have to be unique): Enter 20 integer values -> 9 7 5 3 8 6 4 2 9 7 5 3 8 6 4 2 9 7 5 3 Data sorted by number of divisors: 2 2 3 3 3 5 5 57 7 7 4 4 9 9 9 6 6 8 8
Problem: Given 20 positive integers as input, calculate the number of divisors for each integer and sort the data set from smallest to largest based on the number of divisors. When multiple integers have the same number of divisors then sort them smallest to largest. Examples: Integer value 12 has divisors 1, 2, 3, 4, 6, 12 for a total of 6. Prime numbers only have divisors of 1 and the number itself. The integer 1, the smallest value that will be provided as input, has only a single divisor, itself. Example Execution #1: Enter 20 integer values -> 21 15 10 6 3 1 28 13 5 7 9 29 31 37 17 19 12 43 24 2 Data sorted by number of divisors: 1 2 3 5 7 13 17 19 29 31 37 43 9 6 10 15 21 12 28 24 Example Execution #2 (data does not have to be unique): Enter 20 integer values -> 9 7 5 3 8 6 4 2 9 7 5 3 8 6 4 2 9 7 5 3 Data sorted by number of divisors: 2 2 3 3 3 5 5 57 7 7 4 4 9 9 9 6 6 8 8
C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter16: Searching, Sorting And Vector Type
Section: Chapter Questions
Problem 16SA
Related questions
Question
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning