training

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

rombo.c (541B)


      1 /* Esercizio 4.31 */ 
      2 
      3 #include <stdio.h>
      4 
      5 int main()
      6 {
      7    int i, j, k, x;
      8 
      9    for(i = 1, x = 4; i <= 9; i += 2, --x) {
     10       for(j = x; j >= 1; --j) /* stampa 'x' spazi */ 
     11 	 printf(" ");
     12 
     13       for(k = i; k >= 1; --k) /* stampa 'i' asterischi */
     14          printf("*");
     15 
     16       printf("\n");
     17    }
     18 
     19    for(i = 7, x = 1; i >= 1; i -= 2, ++x) { 
     20       for(j = x; j >= 1; --j) /* stampa 'x' spazi */
     21 	 printf(" ");
     22 
     23       for(k = i; k >= 1; --k) /* stampa 'i' asterischi */
     24 	 printf("*");
     25       printf("\n");
     26    }
     27 
     28    return 0;
     29 } /* E0F main */
     30