Skip to content

Instantly share code, notes, and snippets.

@anuradhawick
Created November 13, 2014 13:29
Show Gist options
  • Save anuradhawick/6f9b8fe4eb0df9b95465 to your computer and use it in GitHub Desktop.
Save anuradhawick/6f9b8fe4eb0df9b95465 to your computer and use it in GitHub Desktop.
Euler 5
#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