training

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

powtab.c (635B)


      1 /* Esercizio 2.31 (Cap. 2)
      2    Mostra una tabella con il calcolo dei
      3    quadrati e cubi dei numeri da 0 a 10. */
      4 
      5 #include <stdio.h>
      6 
      7 int main()
      8 {
      9    printf("numero\tquadrato\tcubo\n");
     10    printf("0\t0\t\t0\n");
     11    printf("1\t1\t\t1\n");
     12    printf("2\t%d\t\t%d\n", 2*2, 2*2*2);
     13    printf("3\t%d\t\t%d\n", 3*3, 3*3*3);
     14    printf("4\t%d\t\t%d\n", 4*4, 4*4*4);
     15    printf("5\t%d\t\t%d\n", 5*5, 5*5*5);
     16    printf("6\t%d\t\t%d\n", 6*6, 6*6*6);
     17    printf("7\t%d\t\t%d\n", 7*7, 7*7*7);
     18    printf("8\t%d\t\t%d\n", 8*8, 8*8*8);
     19    printf("9\t%d\t\t%d\n", 9*9, 9*9*9);
     20    printf("10\t%d\t\t%d\n", 10*10, 10*10*10);
     21 
     22    return 0;
     23 } /* E0F main */
     24