求最大公约数
2016-03-25 18:00
260 查看
*copvriqht(c)2016,烟台大学计控学院
*All rights re
4000
served.
*文件名称:test.cpp
*作者:张全伟
*完成日期:2016年3月25日
*版本号:codeblocks1.6;
*
*/
#include <iostream>
using namespace std;
int gcd(int x,int y);
int main()
{
int a,b,c;
cin>>a>>b;
g=gcd(a,b);
cout<<"最大公约数是"<<c;
return 0;
}
int gcd(int x,int y)
{
int n,i;
if(x>y)
n=y;
else
n=x;
for(n=i;i>=1;i--)
{
if(x%i==0&&y%i==0)
return i;
}
}
*All rights re
4000
served.
*文件名称:test.cpp
*作者:张全伟
*完成日期:2016年3月25日
*版本号:codeblocks1.6;
*
*/
#include <iostream>
using namespace std;
int gcd(int x,int y);
int main()
{
int a,b,c;
cin>>a>>b;
g=gcd(a,b);
cout<<"最大公约数是"<<c;
return 0;
}
int gcd(int x,int y)
{
int n,i;
if(x>y)
n=y;
else
n=x;
for(n=i;i>=1;i--)
{
if(x%i==0&&y%i==0)
return i;
}
}
相关文章推荐
- 3月25日问题解决<jQuery>
- mysql-error --(ERROR 1135 (HY000): Can't create a new thread (errno 11); if you are not out)
- CentOS的文件权限与目录配置
- 判断是否为数字Util--笔记
- JSON 和 XML 优缺点的比较 (2012-08-23 18:08:15)
- GDOI2012 AB棋(chess)解题报告
- jvm系列堆和栈的区别(一)
- ftrace 简介【转】
- key management documents(1) - test policy document
- 构建之法阅读笔记04
- Xcode因为证书问题经常报的那些错
- iOS开发小记:初次接入环信SDK3.0时遇到的问题及解决办法汇总
- springmvc注解中的@requestmapping
- unity3d,声音播放
- Diamond续集之核心原理简介
- linux arm的存储分布那些事之一
- mysql show processlist详解
- SYS用户登录em管理界面失败
- multidex导入至build失败问题
- 系统的引导和服务的查询 优化 控制