编辑代码

#include<iostream>
using namespace std;
int divideSquare(int length,int width)
{
	if(length<width||length<=0||width<=0)
	cout<<"error";
	if(length%width==0)
	return width;
	int smallwidth=length%width;
	return divideSquare(width,smallwidth);

 } 
 int main(){
   int length =9,width=3;
   cout<<"农民分得正方形土地宽为"<<divideSquare(length,width);
 }