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

 

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

Write a method that returns the sum of the two input parameters UNLESS the second number is less than the first number. In that case, return the difference between those two numbers. Look at the test data for examples.


test2021_09_16_APSLHL_addOrSubtract(23987, 2419) → 21568
test2021_09_16_APSLHL_addOrSubtract(324987, 214646) → 110341
test2021_09_16_APSLHL_addOrSubtract(15, 20) → 35

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

public int test2021_09_16_APSLHL_addOrSubtract(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: 220

Copyright Nick Parlante 2017 - privacy