Assuming you mean Celsius:
The ideal sleep temperature is between 20-26 degrees Celsius. However, if it is too hot or too cold outside of this range, there are ways to make sleeping more comfortable.
If it is 40 degrees Celsius outside, it will likely be too hot to sleep comfortably without air conditioning. If possible, try to find a room that has air conditioning or use a fan to circulate the air. You may also want to consider wearing light and breathable clothing to bed and using lighter blankets.
Sleeping in excessive heat can lead to dehydration so be sure to drink plenty of fluids during the day and keep a water bottle by your bedside at night. Avoid caffeine and alcohol before bed as they can make overheating worse. Lastly, try to avoid strenuous activity before bedtime as this will raise your body temperature even further.