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

 

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

Write a method that returns the difference between the one's places of the two input parameters, but only if both of those parameters are positive. If either or both of them are negative or zero, return -1 as an error code. For example, with the input values of 75 and 23, return 2 because the difference between 5 and 3 (the numbers in the one's places) is 2. Please look at the test data for additional examples. You are NOT allowed to use ANY string methods or operations in solving this problem.


nov20_2015_APSLHL_differenceOnesPlace(925381, 428) → 7
nov20_2015_APSLHL_differenceOnesPlace(142, 634) → 2
nov20_2015_APSLHL_differenceOnesPlace(7, 54007) → 0

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

public int nov20_2015_APSLHL_differenceOnesPlace(int a, int b) { }

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