wsq7

this one was really important, but I would say it I don’t understand well arrays and how they are manage for that reason I do this wsq with other methods that are valid but it would be better for it to have done it with the way you say it Ken sorry.

#include <iostream>
#include <cmath>
using namespace std;

float sum (float a, float b, float c, float d, float e, float f, float g, float h, float i, float j){
float Rsum;
Rsum = (a + b + c + d + e + f + g + h + i + j);
return Rsum;
}
float prom (float a, float b, float c, float d, float e, float f, float g, float h, float i, float j){
float Rprom;
Rprom = ((a + b + c + d + e + f + g + h + i + j)/10);
return Rprom;
}
float desviacionstd (float a, float b, float c, float d, float e, float f, float g, float h, float i, float j){
float varianza ,total, Desviacion;
total = (a + b + c + d + e + f + g + h + i + j)/10;
varianza = pow(a-total,2)+pow(b-total,2)+pow(c-total,2)+pow(d-total,2)+pow(e-total,2)+pow(f-total,2)+pow(g-total,2)+pow(h-total,2)+pow(i-total,2)+pow(j-total,2);
Desviacion = sqrt(varianza/10);
return Desviacion;
}
int main(){
float a,b,c,d,e,f,g,h,i,j,sumatoria,promedio,desviacionstandart;
cout << «inserte 10 numeros» << endl;
cin >> a;
cin >> b;
cin >> c;
cin >> d;
cin >> e;
cin >> f;
cin >> g;
cin >> h;
cin >> i;
cin >> j;
sumatoria = sum(a,b,c,d,e,f,g,h,i,j);
promedio = prom(a,b,c,d,e,f,g,h,i,j);
desviacionstandart = desviacionstd(a,b,c,d,e,f,g,h,i,j);
cout << «la sumatoria es » << sumatoria << endl;
cout << «el promedio es «<< promedio << endl;
cout << «la desviacion es «<< desviacionstandart << endl;
return 0;
}

2017-03-30 (6).png2017-03-30 (7).png

 

Deja un comentario