I have to find all the pythagorean triples which have a value of "c" (where c is the hypotenuse) smaller than an integer number entered by the user. I was able to do this, however I also have to print which triple has the largest value of "c".
# include <stdio.h>
int main()
{
int i=1, N, a, b, c;
printf("Please enter an integer number: ");
scanf("%d", &N);
for(c=1; c<N; c++)
{
for(b=1; b<c; b++)
{
for(a=1; a<b; a++)
{
if((a*a)+(b*b)==(c*c))
{
printf("\n%d.(%d,%d,%d)\n", i++, a, b, c);
}
}
}
}
printf("\nThere are %d triples which contain a c<N.\n\n", (i++)-1);
system("PAUSE");
return(0);
}