User Tools

Site Tools


qna:lab-session:code1
#include <stdio.h>
 
void printFactors(int n)
{
    for (
         int factor = 2;
         factor <= n/(double)factor;
         factor++
    ) {
        while (n % factor == 0) {
            n /= factor;
            printf("%d ", factor);
        }
    }
 
    if (n > 1) {
        printf("%d ", n);
    }
    printf("\n");
    return;
}
 
int main() {
   printFactors(60);
   return 0;
}
qna/lab-session/code1.txt · Last modified: 2024/04/24 15:31 by xallos