當前位置:首頁 » 編程語言 » 1210c語言

1210c語言

發布時間: 2023-03-24 08:45:13

1. C語言求平均值,標准差

#include "stdio.h"
#include "math.h"
#define N 100
void main()
{
int a[N],n,i;
float aver,s;
float sum=0,e=0;
printf("請輸入樣本量:");
scanf("%d",&n);
printf("請輸入%d個樣本:",n);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
sum+=a[i];
}
aver=sum/n;
for(i=0;i<n;i++)
e+=(a[i]-aver)*(a[i]-aver);
e/=n-1;
s=sqrt(e);
printf("平均數為:%.2f,方差為:%.2f,標准差為:%.2f\n",aver,e,s);
}

熱點內容
資料上傳口 發布:2025-10-20 06:08:50 瀏覽:385
mac上c編譯器 發布:2025-10-20 06:07:08 瀏覽:157
python編譯文件壓縮 發布:2025-10-20 05:54:07 瀏覽:13
ftp上傳html打開是空白的 發布:2025-10-20 05:47:08 瀏覽:927
冬天霸腳本 發布:2025-10-20 05:32:44 瀏覽:934
快速排序c語言實現 發布:2025-10-20 05:23:20 瀏覽:16
android不死service 發布:2025-10-20 05:22:33 瀏覽:84
申請微信時默認密碼是什麼 發布:2025-10-20 05:17:46 瀏覽:565
網易電腦版為什麼不能進入手機伺服器 發布:2025-10-20 04:55:21 瀏覽:306
我的世界如何查找伺服器真實的ip 發布:2025-10-20 04:53:18 瀏覽:174