This shows you the differences between two versions of the page.
| — |
qna:lab-session:code1 [2024/04/24 15:31] (current) xallos created |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | <code c># | ||
| + | void printFactors(int n) | ||
| + | { | ||
| + | for ( | ||
| + | int factor = 2; | ||
| + | | ||
| + | | ||
| + | ) { | ||
| + | while (n % factor == 0) { | ||
| + | n /= factor; | ||
| + | printf(" | ||
| + | } | ||
| + | } | ||
| + | |||
| + | if (n > 1) { | ||
| + | printf(" | ||
| + | } | ||
| + | printf(" | ||
| + | return; | ||
| + | } | ||
| + | |||
| + | int main() { | ||
| + | | ||
| + | | ||
| + | } | ||
| + | </ | ||