Domanda di colloquio di evosoft

How would you refactor this piece of code?