#include #include // Richiesto per rand() e srand() #include // Richiesto per time() using namespace std; int main() { srand(time(0)); const int MAX_CONTEGGIO = 10; int contatore = 0; float somma = 0; while(contatore < MAX_CONTEGGIO) { contatore++; int numeroRandom = rand(); //cout << "Numero random = " << numeroRandom << endl; int numeroCasuale = (numeroRandom % 100) + 1; somma += numeroCasuale; cout << "[iterazione = " << contatore << "] numero casuale = " << numeroCasuale << endl; } cout << endl; cout << "La somma dei valori ottenuti e' " << somma << endl; cout << "Il numero di campioni acquisiti e' pari a " << contatore << endl; float media = somma / contatore; cout << endl << "La media vale " << media << endl; }