calculate average of multiple line data

I have a question as below and i need to write a shell or perl script for this query:My Input file looks like below

RNo Marks

12 50
15 70
18 80
12 40
13 55
18 88
13 75
12 78
15 88

I want to calculate the average based on RNo.

I need the Output as:

RNo Average

12 .....
13 .....
15 .....
18 ......
Please answer this query and send me the script.

awk '{ cnt[$1]++; tot[$1]+$2}
        END{ for (i in tot) { print i, tot/cnt} ' inputfile

I am getting ouput as follows:

12 0
13 0
15 0
18 0

But I want the output as follows:

12 avg(Rno 12)
13 avg(Rno 13)
15 avg(Rno 15)
18 avg(Rno 18)

awk '{ cnt[$1]++; tot[$1]+=$2 } \
END{ for (i in tot) { print i, tot[i]/cnt[i]}} ' file

Output:

12 56
13 65
15 79
18 84