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

 

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

Write a method that returns the sum of the two input parameters, except if the sum ends with zeros, return the value without those zeros. So if the sum is 500, only return 5. But if the sum is 720, return 72. However, if the sum comes out negative, simply return that sum regardless of the result. Look at the test data for further examples. You are not allowed to use any string methods in this problem.


dec18_2015_APSLHL_findSum(17, 3) → 2
dec18_2015_APSLHL_findSum(452, 48) → 5
dec18_2015_APSLHL_findSum(700000, 0) → 7

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

public int dec18_2015_APSLHL_findSum(int num1, int num2) { }

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: 250

Copyright Nick Parlante 2017 - privacy