Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <math.h>
- int main()
- {
- int quantValores,i;
- printf("\n Digite a quantidade de valores: ");
- scanf("%d",&quantValores);
- float listaDeNumeros[quantValores],somaValores=0,media,desvioPadrao,soma=0;
- for(i=0;i<quantValores;i++)
- {
- printf("\n Digite um valor: ");
- scanf("%f",&listaDeNumeros[i]);
- somaValores += listaDeNumeros[i];
- }
- media=somaValores/quantValores;
- for(i=0;i<quantValores;i++)
- {
- soma += pow((listaDeNumeros[i]-media),2);
- }
- desvioPadrao = sqrt((1.0/(quantValores-1))*soma);
- printf("\n Desvio padrao = %.3f",desvioPadrao);
- getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement