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

 

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

Write a method that finds the sum of 'num1', 'num2', and 'num3', but ONLY include those numbers in the sum if they are even numbers. For example, if the numbers were 6,2,3 the sum would be 8 because you included 6 and 2 but did not include 3. As preconditions, you may assume that all three numbers are positive. Look at the test data for more examples.


test2022_11_03_APP1SLHL_sumEvens(4, 5, 6) → 10
test2022_11_03_APP1SLHL_sumEvens(7, 1, 9) → 0
test2022_11_03_APP1SLHL_sumEvens(8, 2, 40) → 50

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

public int test2022_11_03_APP1SLHL_sumEvens(int num1, int num2, int num3) { }

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