作者dgf130 (JoyChen)
看板TransCSI
标题Re: [问题] 找出所有因数的演算法
时间Wed Dec 6 23:50:23 2006
※ 引述《buoyance (buoyance)》之铭言:
: design an algorithm for finding all the factors of a positive integer
factors( int num )
{
printf("%d factors are ",num);
for( int i = 1; i <= num; i++ )
if( num%i )
printf( "%d, ",i );
}
就检查1~自己本身的数能不能整除就好啦~应该不难
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.113.126.59