0
問題:項目歐拉C#3
「?的13195的首要因素是5,7,13和29
號碼是多少600851475143的最大質因數」
#include<iostream.h>
#include<conio.h>
#include<math.h>
void main()
{
clrscr();
long double x=600851475143,n;
for(n=2;;n++)
{redo:if(fmod(x,n) == 0)
{ x=x/n;
goto redo;
}
if(x == 1)
{
cout<<n
break;
}
}
getch();
}
我試圖解決它,而無需使用蠻力但是我的輸出始終是688543. 我無法找到毛刺。 請幫忙。 謝謝。
'for - goto/label'的使用讓我哭泣 – Michael
您的縮進是....創意....至少可以說。加上不存在的頭文件,錯誤的'main'返回類型,'goto'控制''流','getch()'....我可以繼續。 –