Domanda di colloquio di Microsoft

Code a function which output an integer or a double when a string representing a number is given as input.