Search the internet for examples how to get orientation. There are plenty. Especially arduino community has a lot of them. Again it depends what are your requirements.
Thank you for replying. My requirement has changed. Now I will be having my device with accelerometer and gyroscope sensors in it and the device is kept randomly in a vehicle. I was wondering how can I know the vehicle direction (going forward) using acc and gyro. Please give me some Idea.