Ask your own question, for FREE!
Computer Science 6 Online
OpenStudy (anonymous):

I have a c programming task that need a result as below: 99=11*3*3 100=5*5*2*2 101=101 102=17*3*2 If someone know how to do this programming, please share with me. Thank you.

OpenStudy (anonymous):

it is simple just make factors

OpenStudy (anonymous):

but how to make the larger prime factor appear first followed by the smaller one?

OpenStudy (anonymous):

logic part looks like this.. for(i=2;i<=n;i++) { if(n%i==0) { printf("%d*",i); } }

OpenStudy (anonymous):

but the result will be a smaller prime number to appear first, is'nt it? for example n=10, the result i want is 10=5*2 do you have any idea?

OpenStudy (anonymous):

ther's a prob with that peudo code............it may not list all the prime facotors.......... say 8.....it wud give smthin like 2*4

OpenStudy (anonymous):

i suggest u use recursion....

OpenStudy (anonymous):

cin>>n; for(i=2;i<(n/2);i++) if(n%i==0) {a=n/i; cout<<i<<"*"<<a;

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!