promotion image of download ymail app
Promoted

C++ 程式碼高手幫忙解題.. 關於 最大公因數 ”高點數”

C++ 高手幫忙解題.. 關於 最大公因數

由於有畫圖

所以我用成圖片網址

請複製進去看看^^"

http://img261.imageshack.us/img261/9980/12467036la...

謝謝喔

1 Answer

Rating
  • Allen
    Lv 4
    1 decade ago
    Favorite Answer

    #include<iostream>

    #include<cstdlib>

    int gcd(int,int);

    using namespace std;

    int main(void){

    int n,m;

    cout<<"n =>";

    cin>>n;

    cout<<"m =>";

    cin>>m;

    cout<<"gcd("<<n<<","<<m<<") => "<<gcd(n,m)<<endl;

    system("pause");

    return 0;

    }

    int gcd(int n,int m){

    if(m==0) return n;

    else return gcd(m,n%m);

    }

    • Commenter avatarLogin to reply the answers
Still have questions? Get your answers by asking now.