Created
February 6, 2014 01:23
-
-
Save atomictom/8836797 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <stdint.h> | |
int64_t gcd(int64_t a, int64_t b){ | |
if(!b) | |
return a; | |
return gcd(b, a%b); | |
} | |
int64_t gcd2(int64_t a, int64_t b){ | |
while(b){ | |
int64_t temp = a%b; | |
a = b; | |
b = temp; | |
} | |
return a; | |
} | |
int main(){ | |
printf("%ld\n", gcd2(121, 11)); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment