Input voltage control by resistor, is this method is correct or not?
Here I applied one Input resistor to control Input voltage flow.

This solution won't work if there's a possibility for the load to be disconnected or for its current to drop significantly because then the 7805 input will be subjected to ~40 V.
If you know the load will always be there and always draw at least 3 mA, then this is viable.
If you want to be safer about it, you could add a 30 or 35-V zener in parallel with C1.

or there is another efficient way to solve this kind of thing.

You could choose another regulator that allows more than 40 V on its input.