IPad shutting off/restarting Problem?

I Have the IPad Air, it isn’t even a year old yet and it keeps shutting down by itself. when it turns back on it says mist enter code after iPad restarted. I’m not understanding why this is happening, I have the latest software update and I sync my device weekly. I want to solve this before my warranty is up at Christmas time because these are not pocket change priced devices, if anyone can please help or direct me where to go it would be greatly appreciated. Also this problem occurs at least 2-5 times a week! Please help