Display .ppm as gray scale image

I’m new to OpenGL and have been using GLUT in Visual C++ 2008 to code in it for a little more than a week now. I have found and used a .ppm uploader to get a .ppm image and display it on the screen. My question is, how do I display it as a gray scale image? I’m required to “average the three RGB values for every pixel” in order to do it, but I have no clue how to do that!

I’ll be grateful for your time and help! Thanks!

Now, all I need to know is how to find out and change the RGB value of any pixel in the image. Please help me, thanks!