So my longer answer below assumes that the board will undergo acceleration and during this time you still need to be able to measure your pitch, roll and yaw within a short amount of time. If the board will be stationary for all measurements then Mahendra Gunawardena's answer will work perfectly for you. If this is going into a device like a segway or model plane or multirotor or anything that moves around, you may want to keep reading. This post is about how to use all three sensors though a method called sensor fusion. Sensor fusion allows you to get the strengths of each sensor and minimize the effects of each sensors weaknesses.
Sensor characteristics and background
First understand that an accelerometer measure all forces being applied to it, not just the force of gravity. So in a perfect world with the accelerometer in a stationary position without any vibrations you could perfectly determine which way is up using some basic trigonometry as shown by Mahendra Gunawardena's answer. However since an accelerometer will pick up all forces, any vibrations will result in noise. It should also be noted that if the board is accelerating you can not just use simple trigonometry as the force the accelerometer is reporting is not only the earths force of gravity but also the force that is causing you to accelerate.
A magnetometer is more straightforward then an accelerometer. Movement will not cause problems with it but things like iron and other magnets will end up effecting your output. If the sources causing this interference are constant its not to hard to deal with but if these sources are not constant it will create tons of noise that is problematic to remove.
Of the three sensors, the gyroscope is arguable the most reliable and they are normally very very good at measuring rotational speed. It is not affected by things like iron sources and accelerations have basically no impact on their ability to measure rotational speed. They do a very good job of reporting the speed at which the device is turning at, however since you are looking for an absolute angle you have to integrate the speed to get position. Doing this will add the error of the last measurement to the error of the new measurements since integration is basically a sum of values over a range, even if the error for one measurement is only 0.01 degrees per second off, in 100 measurements, your position can be off by 1 degree, by 1000 measurements, you can by off by 10 degrees. If you are taking hundreds of measurements a second, you can see this causes problems. This is commonly called gyro drift.
Now the beauty of having all of these sensors work together is that you can use the information from the accelerometer and magnetometer to cancel out gyro drift. This ends up allowing you to giving you the accuracy and speed of the gyro without the fatal flaw of gyro drift.
Combining the data from these three sensors can be done in more then one way, I'll talk about using a complementary filter because its far simpler then a kalman filter and kalman filters will eat up much more resources on embedded systems. Often times a complementary filter is good enough, simpler to implement(assuming your not using a pre-built library) and lets you process the data faster.
Now onto the process. The first steps you need to do is to integrate the gyroscope output to convert the angular speed into angular position. You will also most likely have to apply a low pass filter on the accelerometer and magnetometer to deal with noise in the output. A simple FIR filter like the one shown below works here. With some trigonometry you can find the pitch and roll with the accelerometer and the yaw with the magnetometer.
filteredData = (1-weight)*filteredData + weight*newData
The weight is just a constant that can be adjusted depending on how much noise you have to deal with, the higher the noise is the smaller the weight value will be. Now combining the data from the sensors can be done by the following line of code.
fusedData = (1-weight)*gyroData + weight*accelMagData
It should be noted that the data is a vector of the pitch, roll and yaw. You can just use three variables to do this as well instead of arrays if you want. For this calculation the gyro provides a position in degrees in pitch, roll and yaw, the magnetometer provides an angle for yaw while the accelerometer provides its own numbers for pitch and roll.
If you still want more information you can google "sensor fusion with complementary filter" there are plenty of articles about this.