编辑代码

#include <iostream>
using namespace std;

int divideToSquareIter(int length,int width){
    int w = length%width;
    while(w>0){
        
        length = width;
        width = w;
        w = length%width;
    }
    return width;
}
int main() {
   
	cout << "递推法:" << divideToSquareIter(1680,640) << endl;
	return 0;
}