The sun's surface temperature is approximately 5,778 Kelvin (5,505 degrees Celsius or 9,941 degrees Fahrenheit). This is the temperature of the sun's photosphere, which is the layer of the sun that we see.
The sun's core temperature is estimated to be about 15 million Kelvin (15 million degrees Celsius or 27 million degrees Fahrenheit). This is the temperature at the sun's center, where nuclear fusion reactions occur and energy is generated.
The reason why the sun is hotter at its center is because of the pressure. The pressure in the sun's core is much higher than the pressure at the surface. This pressure compresses the atoms in the core and causes them to move faster. The faster the atoms move, the hotter the sun becomes.
The temperature gradient in the sun is about 0.5 Kelvin per meter (0.0009 degrees Celsius per meter or 0.0016 degrees Fahrenheit per meter). This means that the temperature decreases by 0.5 Kelvin for every meter you move away from the sun's center.