算法复习-欧几里得最大公因子

#include<iostream>
#include<stdio.h>
using namespace std;
int main (){
    int m=20;
    int n=8;
    int x=m;
    int y=n;
    while((x%y)!=0)
    {
        int temp=y;
        y=(x%y);
        x=temp;
    }
    cout<<y;
    system("pause"); 
    return 0;
}

 

posted on 2017-10-30 20:54  mdumpling  阅读(303)  评论(0编辑  收藏  举报

导航