Adding to what Salman said, that explains why patenting programs is not
generally allowed in the EU, it is still allowed to patent computer related
stuff, like mp3 was for a long time or the rar algorithm ¿is right now?
Maybe those computer related patents could make sense if they lasted for a
much shorter period than now.
You might thing that a car company needs 20 years to find a decent profit
from another 10 investment in the development of a new engine, but claiming
such with computers is just ridiculous. The profit will largely overcome the
spends in less than a couple of years, having in mind that no company will
spend as much time developing patentable stuff as car or the "general"
industry spend.
To show that it is possible to get a profit, you can always refer to RedHat:
https://www.redhat.com/en/about/patent-promise