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

 

david_petty@psbma.org > swapLeastSignificantDigits
prev  |  next  |  chance

Write an expression that, given a non-negative integer n, computes a new integer in which the units and tens digits have swapped places. For example, if n = 123, the result should be 132; if n = 3, the tens digit is zero and the result should be 30. Return the result of a single expression that calculates a number with the units and tens digits of n swapped.


swapLeastSignificantDigits(0) → 0
swapLeastSignificantDigits(4) → 40
swapLeastSignificantDigits(70) → 7

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

int swapLeastSignificantDigits(int n) { }

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: 10 Post-solution available

Copyright Nick Parlante 2017 - privacy