Write a program that reads in a positive integer from the


Write a program that reads in a positive integer from the user and outputs a count of its divisors and whether the input positive integer is a prime number or not. Your program must verify the input is valid. Allow the user to repeat this as many times as they wish (for possibly different inputs). For example, if the user inputs 25, your program must output: 25 has 3 divisors and is not prime If the user inputs 24, your program must output: 24 has 8 divisors and is not prime If the user inputs 13, your program must output: 13 has 2 divisors and is prime Note that 25 has 3 divisors, namely, 1, 5, and 25. 24 has 8 divisors, namely, 1, 2, 3, 4, 6, 8, 12, and 24. 13 has two divisors, namely 1 and 13. Observe that a positive integer is a prime number if it has exactly 2 divisors.

Solution Preview :

Prepared by a verified Expert
Business Management: Write a program that reads in a positive integer from the
Reference No:- TGS02690656

Now Priced at $10 (50% Discount)

Recommended (94%)

Rated (4.6/5)