#include <iostream>
using namespace std;
int divideToSquare(int length, int width) {
if (length % width == 0) {
return width;
}
return divideToSquare(width, length % width);
}
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 << "The length of square for rectangle(1680, 640) is " << divideToSquare(1680, 640) << endl;
cout << "The length of square for rectangle(1680, 640) is " << divideToSquareIter(1680, 640) << endl;
return 0;
}