第4週プロジェクト1(1)最大公約数を求める

1016 ワード

<pre name="code" class="html">      :  
/*Copyright (c) 2016,           
*All rights reserved.  
*     :  
*       :     
*     : 2016 3 19   
*      : v1.0  
*  
*     :           
*     :       
*     :             
*/  
 
 


#include <iostream>
using namespace std;
int gcd(int a,int b);
int main()
{
    int a,b,g;
    cin>>a>>b;
    g=gcd(a,b);
    cout<<"      : "<<g;
    return 0;
}
int gcd(int a,int b)
{
    int r;
    while(r!=0)
    {
        r=a%b;
        a=b;
        b=r;
    }
    return a;
}
      :
     <img src="http://img.blog.csdn.net/20160319162327544?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" />
      :  
          ,                ,                   
      :  
         ,      C++,     ,         。