brute force method for Euler# 09

This commit is contained in:
Krishna Vedala 2020-03-29 21:20:49 -04:00
parent 90e6ee0771
commit 30bc9a201f
No known key found for this signature in database
GPG Key ID: BA19ACF8FC8792F7

View File

@ -0,0 +1,18 @@
#include <stdio.h>
int main(void)
{
for (int a = 1; a < 300; a++)
for (int b = a+1; b < 400; b++)
for (int c = b+1; c < 500; c++)
{
if (a * a + b * b == c * c)
if (a + b + c == 1000)
{
printf("%d x %d x %d = %ld\n", a, b, c, (long int) a*b*c);
return 0;
}
}
return 0;
}