You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
347 B
C
27 lines
347 B
C
#include "genlib.h"
|
|
|
|
/*tries factor*/
|
|
int test_fact(int *pnum, int fact, int *pmaxfac)
|
|
{
|
|
int power, t;
|
|
|
|
power = 0;
|
|
while ( ( t = *pnum / fact ) * fact == *pnum ) {
|
|
++power;
|
|
*pnum = t;
|
|
}
|
|
|
|
if ( power != 0 ) {
|
|
if (fact > *pmaxfac)
|
|
*pmaxfac = fact;
|
|
}
|
|
|
|
if ( t > fact ) {
|
|
return (1);
|
|
}
|
|
|
|
return (0);
|
|
}
|
|
|
|
|