simple moving average in c