Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
MeanSDVar
//g++ 7.4.0 //calculate mean, standard deviation and variance // created by Rezaul Hoque on Dec 17,2020 //contact at jewelmrh@yahoo.com #include <iostream> #include <cmath> using namespace std; int main() { int n=3,sum=0,sum2=0; int a[n]={2,4,8}; float mean, SD, preSD,var; for(int i=0;i<n;i++) { sum += a[i]; } mean = sum/n; for(int i=0; i<n; i++) { sum2 += (a[i]-mean)*(a[i]-mean); } preSD= sum2/n; SD= sqrt(preSD); var = SD*SD; cout<<"Mean:\t"<<mean; cout<<endl; cout<<" Standard Deviation:\t"<<SD; cout<<endl; cout<<"Variance:\t"<<var; return 0; }
run
|
edit
|
history
|
help
0
Get all anagrams from given words
template example
BLREDSET
My billing system
-Wall -std=c++14 -O0 -o a.out source_file.cpp
euler tour (by pure theory)
numberOftweets
spiral traversal of a matrix
cppPyAbs
sysFork3