#include <stdio.h>
#include <math.h>
int minDivisor(int value) {
if (value <= 3)
return 1;
if (value % 2 == 0)
return 2;
int n = (int) (sqrt(value) + 0.5);
for (int divisor = 3; divisor <= n; divisor += 2)
if (value % divisor == 0)
return divisor;
return 1;
}
int main() {
int n = 33;
int smallest = minDivisor(n);
int biggest = n / smallest;
printf("%i = %i * %i", n, smallest, biggest);
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: