Created
November 13, 2014 13:29
-
-
Save anuradhawick/6f9b8fe4eb0df9b95465 to your computer and use it in GitHub Desktop.
Euler 5
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> | |
typedef int bool; | |
#define true 1 | |
#define false 0 | |
void main(){ | |
long long int i,p=1,t,t2; | |
for(i=2;i<=20;i++){ | |
p = (p*i)/gcd(p,i); | |
} | |
printf("%lld",p); | |
} | |
int gcd(long long int a,long long int b){ | |
if (a>b){ | |
if(b==0){ | |
return a; | |
} | |
else{ | |
return gcd(b,a%b); | |
} | |
} | |
else{ | |
if(a==0){ | |
return b; | |
} | |
else{ | |
return gcd(a,b%a); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment