Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main() {
- int i,n,x,somma;
- float media;
- printf(" - CALCOLO DELLA MEDIA - \n");
- printf("Inserisci un numero intero positivo:\n");
- do {
- printf("==> ");
- scanf("%d",&n);
- } while(n < 0);
- printf("Inserisci %d numeri:\n", n);
- for (i=1; i <= n; i++) {
- printf("%d numero ==> ", i);
- scanf("%d",&x);
- somma+=x;
- }
- media=(float)somma/n;
- printf("La media e': %.2f\n",media);
- system("pause");
- return(0);
- }
Add Comment
Please, Sign In to add comment