computing average for each column