Skip to content

Instantly share code, notes, and snippets.

@tmk815
Created June 1, 2018 12:51
Show Gist options
  • Save tmk815/9cd34b1154d8ae69ef235b4a943d03f3 to your computer and use it in GitHub Desktop.
Save tmk815/9cd34b1154d8ae69ef235b4a943d03f3 to your computer and use it in GitHub Desktop.
ユークリッドの互除法
#include <stdio.h>
int gcd(int,int);
int main(void) {
int a, b;
a=394;
b=985;
printf("%d\n",gcd(a,b));
}
int gcd(int a,int b){
return b==0 ? a : gcd(b,a%b);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment