#include <stdio.h>
int gcd(int x, int y);
int main() {
printf("gcd = %d\n", gcd(12, 15));
return 0;
}
int gcd(int x, int y){
int min;
int ret = 0;
if(x > y){
min = y;
} else {
min = x;
}
for(int i = 1; i<=min; i++){
if((x%i ==0) && (y%i == 0)){
ret = i;
}
}
return ret;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: