Skip to content

Instantly share code, notes, and snippets.

@fbrosser
Created December 23, 2011 23:19
Show Gist options
  • Save fbrosser/1515642 to your computer and use it in GitHub Desktop.
Save fbrosser/1515642 to your computer and use it in GitHub Desktop.
Project Euler #9
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char** argv) {
int i,j;
for(i=0; i<500; i++) {
for(j=0; j<i; j++) {
int a = i*i-j*j;
int b = 2*i*j;
int c = i*i+j*j;
if(a+b+c==1000) {
printf("%d", a*b*c);
return (EXIT_SUCCESS);
}
}
}
return (EXIT_SUCCESS);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment