getavrg.c (361B)
1 /* Esercizio 4.10 */ 2 3 #include <stdio.h> 4 5 int main() 6 { 7 int i, value; 8 float average = 0; /* media */ 9 10 printf("Intero: "); 11 scanf("%d", &value); 12 13 for (i = 0; value != 9999; ++i) { 14 average += (float) value; 15 16 printf("Intero: "); 17 scanf("%d", &value); 18 } 19 20 printf("La media è %.2f\n", average / i); 21 22 return 0; 23 } /* E0F main */ 24