Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- int main(int argc, char** argv)
- {
- float x [] = {23,22.7,21.2,21.5,17,28.4,19,14.5,19,19.5};
- float soma = 0;
- for(int i = 0; i <10; i++)
- {
- soma += x[i];
- }
- std::cout<<"Media "<<(soma/10)<<std::endl;
- float variacia = 0;
- for(int i = 0; i <10; i++)
- {
- variacia += pow(x[i] - (soma/10),2) ;
- }
- std::cout<<"Variancia: "<<(variacia/9)<<std::endl;
- std::cout<<"Desvio Padrao: "<<sqrtf(variacia/9)<<std::endl;
- float xx [] = {14.5,17,19,19,19.5,21.2,21.5,22.7,23};
- std::cout<<"Mediana: "<<((xx[5]+xx[4])/2)<<std::endl;
- std::cout<<"Moda: 19"<<std::endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement