Actually you made mistake on print statement.That is ,


System.out.println(+num);

you use "println". So "ln" means each time iterate the loop print statement is print next line.
so that the...