working program with counting the absolute error compared to exact number