training

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

compsum.c (309B)


      1 /* Esercizio 3.5 (Cap 3)
      2    Calcola la somma degli interi da 1 a 10 */
      3 
      4 #include <stdio.h>
      5 
      6 int main()
      7 {
      8    int sum = 0, x = 1; /* Inizializzo le variabili */
      9 
     10    while(x <= 10) {
     11       sum += x;
     12       x++;
     13    }
     14 
     15    /* Stampo i risultati */
     16    printf("The sum is: %d\n", sum);
     17 
     18    return 0;
     19 } /* E0F main */
     20