Done and done. In fact I've found several ways of doing it, and as I type this I am working out how to do it in several other languages. Now what?
EDIT: We would like you to try the code, post what you have so far even if it is just the part that takes the input from the user. From here we will gladley help you. Don't be afraid of trolls, I'm about as bad as we get here ;).
You find the average by taking the numbers you want to find the average of, adding them together, and then dividing that total by the number of numbers that you had.
Assuming your square root is a positive integer, try dividing it by every positive integer lower than itself, except one. If any of them divide exactly, it's not prime.