0

For a given integer n>1, the smallest integer d>1 that divides n is a prime factor. We can find the prime factorization of n if we find d and then replace n by the quotient of n divided by d, repeating this until n becomes 1.

Write a program that determines the prime factorization of n in this manner but that displays the prime factors in descending order. For example, for n = 210, the output should be: 7*5*3*2. Must use stack to solve the problem.

please note--> just show me some way to start...thanks a lot in advance

2
Contributors
2
Replies
4
Views
8 Years
Discussion Span
Last Post by ankit894u
0

What do you know about stacks? Do you have to write your own code for a useable stack or are you allowed to use prewritten code like the Standard Template Library version of stacks?

Do you know how to write loops?

Do you know how to obtain and assign data?

You might even think about a recurssive function, though connecting that with a stack might be more trouble than it's worth.

0

i just want to write a code where in i declare the functions in the header file and then the main program in .cpp file using the stack function...and yes we can use the STL versions of stack like pop, push, empty and others... i know to write the while, if else and kind of loops .....i m just stuck bcz of which i dont knw wht to write n where to start from....i would be a great favor if u help me...thanks a lot in advance

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.