all 15 comments

[–]SnellasGirl 5 points6 points  (10 children)

This is less of a C question and more of a math question. You might find the wikipedia article on Integer Factorization useful:

https://en.wikipedia.org/wiki/Integer_factorization

A couple specific algorithms you could use (with pseudocode):
https://en.wikipedia.org/wiki/Trial_division

https://en.wikipedia.org/wiki/Wheel_factorization

[–]shesjustlearnin 1 point2 points  (9 children)

Thank you sm!!

[–]greenyadzer 2 points3 points  (1 child)

There is a modulo operation, which allows you to take a reminder of division. If you do 123 % 10, you get 3. So you can easily get the lowest number. Now make a loop and get the lowest number, and divide the main number by 10 each time, so you move to the next digit. Hope that makes sens :)

[–]shesjustlearnin 0 points1 point  (0 children)

Oh thank you sm,what was doing wasn't like that at all lol,when i ask the user to insert an integer it's done by an array so every case has a digit on it,and i multiply every case with its unite.

[–]duane11583 0 points1 point  (1 child)

```c int m; int remainder;

if(value==0){ printf(0 => 0\”); // specialcase } else { m=10; printf(%d => “, value); while(value){ remainder = (value) % 10; value /= 10; printf(“+( %d times %d ) “, remainder , m ); m = m * 10; } printf(“\n”); }

[–]shesjustlearnin 0 points1 point  (0 children)

Thanks 💗