Código Java:
Ver originalpublic class main {
public static void main
(String[] args
) { System.
out.
println(firstNumber
(13)); }
public static int firstNumber(int num) {
if (num < 10) {
return num;
} else {
return firstNumber(num - (num % 10));
}
}
}
Segun mi entender no deberia devolver ningun error, pero obtengo esto
Código:
Exception in thread "main" java.lang.StackOverflowError
at controlador.main.firstNumber(main.java:12)
at controlador.main.firstNumber(main.java:12)
at controlador.main.firstNumber(main.java:12)