作者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