training

Code I wrote during training
git clone git://git.bitsmanent.org/training
Log | Files | Refs | README

tpbf.c (362B)


      1 /* Esercizio 4.27
      2  * Terne pitagoriche: brute force. */
      3 
      4 #include <stdio.h>
      5 
      6 int main()
      7 {
      8    int i, j, k;
      9 	
     10    printf("IPOTENUSA\tCATETO 1\tCATETO 2\n");
     11    for (i = 1; i < 500; ++i)
     12       for (j = i ; j > i / 2; --j)
     13 	 for (k = 1; k < j ; ++k)
     14 	    if (i * i == j * j + k * k)
     15                printf("%d\t\t%d\t\t%d\n", i, j, k);
     16 
     17    return 0;
     18 } /* E0F main */
     19