WSQ 07- Lists.

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

int main ()
{
float tot, avr, sta;
float numbers [10];
tot =0;
sta =0;

for (int i=0; i<10; i++)
{
cout<<«Please give me the value of a number: «<<endl;
cin>>numbers [i];
tot = tot + numbers[i];Resultado de imagen para cute doggo}

avr=tot/10.0;

for (int i=0; i<10; i++)
{
sta = sta + (numbers [i]-avr)*(numbers [i]-avr);
}

sta = sqrt (sta)/10.0;

cout<<«\nThe total is: «<<tot <<endl;
cout<<«The average is: «<<avr <<endl;
cout<<«The standard deviation is: «<<sta <<endl;

return 0;
}

#masterytopic14 #masterytopic18. In this program I made use of arrays and «for» loops. This program asks the user for 10 numbers and then calculates the sum, average and standard deviation. I had already done my program and it worked only that I didn’t do it how it was supposed to be. Teacher Ken helped me with this one. Thanks Ken.

Deja un comentario