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

 

test2024_10_08_APP1SLHL_funnySum


Write a method that returns the sum of the three integer input parameters, except do NOT include the third number in the sum if the sum of the first two numbers is greater than the third number. For example, if the numbers are 2, 4, 20 you would return 26 because that is the sum of all the numbers and 2+4 is not greater than 20. Here is another example: If the numbers are 20, 10, 5, you would return 30. You would NOT include the 5 in this sum because 20+10 is greater than 5. Look at the test data for other examples.


test2024_10_08_APP1SLHL_funnySum(5, 5, 10) → 20
test2024_10_08_APP1SLHL_funnySum(3, 3, 6) → 12
test2024_10_08_APP1SLHL_funnySum(8, 12, 40) → 60

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

public int test2024_10_08_APP1SLHL_funnySum(int a, int b, int c) { }

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