C
This commit is contained in:
19
DeitelC/Chapter5/greatestCommonDivisor.c
Normal file
19
DeitelC/Chapter5/greatestCommonDivisor.c
Normal file
@ -0,0 +1,19 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int gcd (int, int);
|
||||
|
||||
int main (void) {
|
||||
printf("%d\n", gcd(15, 20));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int gcd (int x, int y) {
|
||||
if(!y) {
|
||||
return x;
|
||||
} else {
|
||||
return gcd(y, x % y);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user