#include <stdio.h>

// Programma somma da limite inf a limite sup

int S; // variabile globale 

int main() { // inizia qui
    int i, inizio, fine; // variabile locale

    S = 0;
    inizio = 1;
    fine = 100;
    i = inizio;
    while ( i <= fine ) { 
        S = S + i; // S compare sia a dx che a sx
        // in generale incremento variabile in fondo
        i = i + 1;
    }
    printf("Somma da %d a %d = %d\n",inizio,fine,S);

} // finisce qui

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: