会员
周边
众包
新闻
博问
闪存
赞助商
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
我思考..我存在..
好好学习..天天向上.. 159753258 楼上我老婆,楼下是我! 呼叫中心、小型信息管理系统,电话:13516218837
博客园
首页
新随笔
联系
管理
订阅
超强算法-求任意二个数的最大公约数
code
1
using
System;
2
using
System.Collections.Generic;
3
using
System.Text;
4
5
namespace
AlgorithmBase
6
{
7
public
class
MaxCommonDivisor
8
{
9
public
static
int
GetMaxCommonDivisor(
int
m,
int
n)
10
{
11
if
(m
<
n)
12
{
13
int
temp
=
m;
14
m
=
n;
15
n
=
temp;
16
}
17
18
int
r
=
m
%
n;
19
20
while
(r
!=
0
)
21
{
22
m
=
n;
23
n
=
r;
24
r
=
m
%
n;
25
}
26
27
return
n;
28
}
29
}
30
}
posted @
2007-05-21 11:18
南守拥
阅读(
401
) 评论(
2
)
编辑
收藏
举报
刷新页面
返回顶部
公告