I guess the only problem with the code is that the total might become very big thus overflow. So, I would rather divide each number by count and then sum in the following way.
You can use this code to see the result in a better manner:
cnt = myrdd.count();
myrdd1 = myrdd.map(devideByCnd);
avg = myrdd.reduce(sum);