Coding Challenge#2 Solution.

Here,goes the solution--
























Explanation of the code--


  1. Import Scanner class,create object s and take n as input.
  2. The variable lastdig stores last digit of n and firstdig stores first digit of n finally at line 23.
  3. Rest is the number after removing first and last digit.
  4. Restfinal is the reverse of rest.
  5. Length stores length of variable.
  6. for loop from 17 to 19 stores length of n.
  7.  for loop from 22 to 25 stores first digit.
  8. For loop from 29 to 31 reverses rest to restfinal.
  9. And,finally line 33 gives the required number.
  10. And fi the final value is printed.


Output--

1)Navigate to file and compile the file.





2)Run the file.





3)Provide a input and get the result.




 Thank You for Visiting our blog.

  Please Share!



Please Stay Tuned for More amazing Content.


0 Comments