第十二周项目3(4)求两书的最大公约数

来源:互联网 发布:php抓取商品信息 编辑:程序博客网 时间:2024/05/16 13:46

*
  * Copyright (c) 2014,烟台大学计算机学院
  * All rights reserved.
  *文件名称: test.cop
  *作者:翟兴雷
  *完成日期:2014年11月13日
  *版本号:v1.0
  *
  *问题描述
  *输入描述:
  *程序输出:
  */

#include <iostream>

using namespace std;
int gcd(int a,int b);
int main()
{
    int a,b;
   cin>>a>>b;
   cout<<gcd(a,b)<<endl;

   return 0;
}
int gcd(int a,int b)
{
    int g;
    if(b==0)
        g=a;

     else  g=gcd(b,a%b);
   return g;
   }

0 0