Login
Immutable PageDiscussionInfoAttachments
rei05/C言語/10026

MMA

   1 #include<stdio.h>
   2 #include<math.h>
   3 int main(){
   4 
   5 int n,s[1000],i;
   6 double a,m1,m2;
   7 
   8 while(1){
   9   m1=0;m2=0;
  10   scanf("%d",&n); if(n==0) break;
  11   for(i=0;i<n;i++){
  12     scanf("%d",&s[i]);
  13     m1+=s[i];
  14   }
  15   for(i=0;i<n;i++){
  16     m2+=pow(s[i]-m1/n,2);
  17   }
  18   a=fabs(sqrt(m2/n));
  19   printf("%lf\n",a);
  20 }
  21 
  22 return(0);
  23 }

rei05/C言語/10026 (last edited 2012-05-26 13:47:22 by rei05)