Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

.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.image text in transcribed

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+1

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing Fundamentals Design And Implementation

Authors: KROENKE DAVID M.

1st Edition

8120322258, 978-8120322257

Students also viewed these Databases questions

Question

Explain the projection of a sensation.

Answered: 1 week ago