Moving Average by macik

using q=System.Console;class Y{static void Main(){var T=new float[999];float s=0;for(int n=0;;){var S=q.ReadLine();s+=T[n++]=float.Parse(S.Substring(7));s-=n>5?T[n-6]:0;q.Write(S+" Average: {0:F1}\n",s/(n>4?5:n));}}}

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page