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

 

jebbert@volusia.k12.fl.us > test2021_12_15_HL_reverseNum
prev  |  next  |  chance

Write a method that returns an integer that has all the digits of 'num' but in reverse order. Note that trailing zeros become leading zeros, but those leading zeros do not appear in the value you return since 0003 is just 3 (for example). You are NOT allowed to use ANY arrays, ArrayLists, or anything similar to that. You are NOT allowed to use Strings. You are NOT allowed to use the Math library. You are NOT allowed to use more than four local variables. You MAY write a recursive solution, but that is not required. Look at the test data for examples.


test2021_12_15_HL_reverseNum(1246) → 6421
test2021_12_15_HL_reverseNum(700000) → 7
test2021_12_15_HL_reverseNum(81005) → 50018

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

public int test2021_12_15_HL_reverseNum(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: 290

Copyright Nick Parlante 2017 - privacy