Are you feeding your 5 month old with any other foods as well as the formula?
Five month old babies can be offered mashed banana, mashed carrot and potato and pulped apple. You can also buy baby rice to make up as instructed on the packet and also jars of different types of foods and desserts for 4 month olds and older. The age range is indicated on the front of the packet/jar/tin so that you know which foods are suitable for your baby.
Do get him examined by the doctor though.
Do not try and treat this yourself. Make an urgent appointment to get your baby examined by the doctor.
There are different types of baby formula available and the one that you are feeding your baby with, may not be right for him. Have you made sure that you have purchased the baby formula that is suitable for his age? Also make sure you follow the instructions how to make up the formula and follow the amount of water to the amount of the formula.
After a certain age you would then change the formula to one that was suitable for the age range.
I do not know the system in your country, but if you are still under the care of a care worker, do have a chat with them too.
Sometimes, if it is very hot, the baby may just need a drink and not a feed. In this case cooled boiled water can be offered in a bottle or off a spoon in between feeds.
Never self treat babies, it is very important to get medical advice.
Let me know how you get on.
Best wishes.
I really urge you to contact a pediatrician and not medicate without a physician's input. Babies and small children are unique. There are many clinics in the U.S. which treat children for free or for a small (ten or fifteen dollar) charge per visit.