#include <iostream>
usingnamespace std;
int main()
{
int c[100];
int A;
int B;
cout<<"please input two numbers"<<endl;
cin>>A;
cin>>B;
int k=0;
while(A>0)
{
int r=B%A;
int C=B-r;
c[k]=C/A;
c[k]=c[k]+1;
A=c[k]-B;
B=B*c[k];
k++;
}
for(int p=0;p<=k;p++)
cout<<c[p];
system("pause");
return 0;
}
my code is not right, and has some issues.but the algorithm is form a ACM book, which is right.