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

 

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

Write a method that returns the "funny sum" of two integer parameters. The "funny sum" is just the sum of the two integers if the first integer is even. However, if the first integer is odd, the "funny sum" is actually the product of the two numbers. Note that it does not matter if the second number is even or odd, on the first number. As a precondition, you may assume that both numbers will be positive.


dec1_2017_APSLHL_funnySum(5, 7) → 35
dec1_2017_APSLHL_funnySum(6, 12) → 18
dec1_2017_APSLHL_funnySum(2, 7) → 9

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

public int dec1_2017_APSLHL_funnySum(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: 250

Copyright Nick Parlante 2017 - privacy