Skip to content

Instantly share code, notes, and snippets.

@pinglunliao
Last active November 5, 2019 08:35
Show Gist options
  • Save pinglunliao/0fa2013efcf1b45b3a04 to your computer and use it in GitHub Desktop.
Save pinglunliao/0fa2013efcf1b45b3a04 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <sstream>
using namespace std;
int main()
{
int a, b;
while(cin >> a >> b)
{
while( a != 0)
{
a = a % b;
b = b - a;
}
cout << b << endl;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment