how to average in awk

Hi,

I have the data like this

$1 $2
1 12
2 13
3 14
4 12
5 12
6 12
7 13
8 14
9 12
10 12

i want to compute average of $1 and $2 every 5th line (1-5 and 6-10)

Please help me with awk
Thank you

awk '{
    x+=$2
    if(!NR%5) {
      printf("avg of lines %d-%d is %.1f\n", NR-4, NR, x/5)
      x=0
    }
}' file

Thank you....let me try the script

Oops, script is not working

Use nawk instead if you are on Solaris.