#include <stdio.h>
#include <math.h>
int main()
{
     int number;
      int count = 0;
       int a[1000];
        int b[1000];
        int c[1000];
         int i,j,k;
          int maxcIndex = 0;
           int maxCvalue = 0;
            /**Ask to user to enter the number*/
            printf("Enter a positive integer:\n ");
             scanf("%d", &number);
              for ( i = 1; i < number; i++)
                {
                    for ( j = i + 1; j < number; j++)
                 {
                      for ( k = j + 1; k < number; k++)
                       {
                           /**	Calculate the total number of Pythagorean triples (a, b, c) with c < N,*/
                            if ((i * i + j * j) == k * k)
                            {
                                /**. every such Pythagorean triple, and a^2 + b^2 =c^2*/
                                a[count] = i; b[count] = j; c[count] = k;
/**Calculate the triple that has the largest value of c*/
 if (maxCvalue < k) { maxCvalue = k; maxcIndex = count;
  }
  count++; /**Increament the count of Pythagorean Triples*/
   }
    }
    }
    }
    /**Print the all required message*/
    if (count == 0)
        {
            printf("There is no Pythagorean triple in this range.\n");
 }
 else
    {
        printf("There are %d Pythagorean triples in this range.\n", count);
 for ( i = 0; i < count; i++)
    {
        printf("(%d, %d, %d)\n", a[i], b[i], c[i] );
 }
  printf("The triple with the largest value of c is (%d, %d, %d).\n", a[maxcIndex], b[maxcIndex], c[maxcIndex]);
   }
   return 0;
}
