Question
.With c++ Make a program for prime factorization (the decomposition of a composite number into a product of prime numbers). First, read a positive integer
.With c++ Make a program for prime factorization (the decomposition of a composite number into a product of prime numbers). First, read a positive integer from the user. Output the equation if the input is a composite number, and output it is a prime number if it is a prime number. (2.5 points) Tips: 1. Start from finding the smallest prime factor of the number. 2. If a factor k equals to the number n, end the process. 3. If the number n is divisible by k, get a new number n/k, and repeat the finding process. 4. If n is not divisible by k, try factor k+1.
4. Make a program for prime factorization (the decomposition First, read a positive integer from the user. Output the equation if the input is a composite number, and output "it is a prime number" if it is a prime number. (2.5 points) Please input a positive integer: 90 902 3 * 3 k 5 Please input a positive integer 16 162 2 * 2* 2 Please input a positive integer: 101 101 is a prime number. Tips: 1. Start from finding the smallest prime factor of the number. 2. If a factor k equals to the number n, end the process 3. If the number n is divisible by k, get a new number n/k, and repeat the finding process. 4. If n is not divisible by k, try factor k+1Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started