标题:求两个正整数。
只看楼主
303770957
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:小飞侠
威 望:6
帖 子:838
专家分:2125
注 册:2005-9-10
得分:0 
以下是引用ww84020209在2006-9-27 21:43:54的发言:

方法2:

#include<stdio.h>
#include<math.h>
int main()
{
int i;
for(i=1;i<=sqrt(120);i++)
{
if(120%i==0 && 667%(i+120/i)==0)
printf("the two numbers are %d,%d\n",i*667/(i+120/i),120/i*667/(i+120/i));
}
}

这个程序到是写的不错语言很简练的!只是我有些看不懂为什么要这么做?
for(i=1;i<=sqrt(120);i++)
{
if(120%i==0 && 667%(i+120/i)==0)
printf("the two numbers are %d,%d\n",i*667/(i+120/i),120/i*667/(i+120/i));
}
能不能给一些提示?


♂ 死后定当长眠,生前何须久睡。♀
2006-10-26 18:28



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-93369-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.020937 second(s), 7 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved