I am going to make a moon phase program. Is there a formula for the phase angle?

Yes, but to be accurate you must account for the eccentricity and inclination of the moon's orbit. The eccentricity of the Earth's orbit around the sun is less imporant, because that orbit is close to circular. There is VERY COMPLICATED commercially available software that does this job right, but it might be an interesting project for a "science fair" to do it yourself.