Merge pull request #82 from fsharpasharp/GCD

I have merged your code. Can you put in some comments.
This commit is contained in:
Christian Bender 2017-12-23 14:17:42 +01:00 committed by GitHub
commit af3648c678
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

15
misc/GCD.c Normal file
View File

@ -0,0 +1,15 @@
#include <stdio.h>
// Euclid's algorithm
int GCD(int x, int y) {
if (y == 0)
return x;
return GCD(y, x%y);
}
int main() {
int a, b;
printf("Input two numbers:\n");
scanf("%d %d", &a, &b);
printf("Greatest common divisor: %d\n", GCD(a, b));
}