#include <bits/stdc++.h>
using namespace std;
long long helmper(long long p,long long s){
long long a,b,q,r;
vector<vector<long long>> v;
vector<long long> temp(4);
a=p;
b=s;
q=a/b;
r=a%b;
//****
temp[0]=a;
temp[1]=b;
temp[2]=q;
temp[3]=r;
v.push_back(temp);
//****
while(r){
a=b;
b=r;
q=a/b;
r=a%b;
//****
temp[0]=a;
temp[1]=b;
temp[2]=q;
temp[3]=r;
v.push_back(temp);
//****
}
for(int i=0;i<v.size();i++){
for(int j=0;j<4;j++){
cout<<v[i][j]<<" ";
}
cout<<endl;
}
return b;
}
int main()
{
// cout<<"Hello World";
long long a,b;
cin>>a>>b;
cout<<helmper(a,b)<<endl;
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: