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

 

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

Write a method that accepts a positive integer input parameter. Return a new integer that has had each of its digits modified in the following way: For digits 1 through 8, simply increase the digit by 1. For the digit 9, replace it with a 1. For the digit 0, leave it unchanged, unless it is not a significant digit (zeros at the RIGHT end of the number are not significant digits), in which case you omit the 0. You may NOT use any strings in solving this problem. Div and Mod are definitely the way to go here! Recursion is optional.


preEaglesDigitIncreaseAdvanced1(10) → 2
preEaglesDigitIncreaseAdvanced1(98765) → 19876
preEaglesDigitIncreaseAdvanced1(421453) → 532564

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

public int preEaglesDigitIncreaseAdvanced1(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