C++ Programming: Assignment 6
C++ Programming: Assignment 6
QUESTION :
FLOWCHART:
START
i=0
Read x[i]
++i
i<SAIZ
WriteStudent<<i<<x*i+
i<SAIZ
i<SAIZ t=x[i] - mean f=pow(t,2) sum=sum+f Std=sqrt(sum)/SAIZ WriteThe standard deviation is :<<std
END
++i
SOURCE CODES : #include <iostream> #include <cmath> using namespace std; int main() { const int SAIZ=10; int i, sum, x[SAIZ]; float total, average, mean, t, std, f; for (i = 0; i<SAIZ; ++i) { cout<<"\nEnter the student's score"<<(i+1)<<":"; cin>>x[i]; } for (i=0; i<SAIZ; ++i) cout<<"\nStudent["<<i<<"] = "<<x[i]; cout<<"\n"<<x[10]; for (i=0; i<SAIZ; ++i) total=total+x[i]; cout<<"\nThe total of the score is :"<<total;
for (i=0; i<SAIZ; ++i) { mean=(float)total/SAIZ; } cout<<"\nThe mean of the score is :"<<mean;
for (i=0; i<SAIZ; ++i) { t = x[i] - mean; f = pow(t,2); sum = sum+f; } std= sqrt(sum)/SAIZ; cout<<"\nThe standard deviation for the score is :"<<std;
OUTPUT :