id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

test2023_12_07_P1SLHL_change


Write a method that returns 'num' but with its least-significant digit moved to the front of the number. For example, if 'num' was 12345 you would return 51234 so the 5 was moved to the front. As a pre-condition, you may assume that 'num' is positive. If 'num' has a zero in its least-significant digit, that zero becomes a leading zero, but since you are returning an integer, it will not appear. For example, if 'num' is 74000 you will return 7400. This may sound easy so far, but here is the kicker: You may NOT use arrays or strings in any way.


test2023_12_07_P1SLHL_change(74000) → 7400
test2023_12_07_P1SLHL_change(128723) → 312872
test2023_12_07_P1SLHL_change(2) → 2

...Save, Compile, Run (ctrl-enter)

public int test2023_12_07_P1SLHL_change(int num) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 240

Copyright Nick Parlante 2017 - privacy