Moving Average by Hendrik

using C=System.Console;using System.Linq;class X{static void Main(){var s=new float[5];for(int i=0;;){var r=C.ReadLine();s[i%5]=float.Parse(r.Remove(0,7));C.Write(r+" Average: {0:F1}\n",s.Sum()/(i++<5?i:5));}}}

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

download

return to the top page