about | help | code help+videos | done | prefs |
Write a method that returns the sum of the three non-negative input parameters, except only count the second and third numbers in the sum if they are even numbers. The first number counts in the sum regardless if it is even or odd. For example, for the input parameters 5,6,3 the result would be 11 since the third number is not even and is therefore not counted. Look at the test data for more examples. HINT: You can test for a number to be even or odd using the mod operator '%'. If num%2 is zero, it means that num is even, and if num%2 is NOT zero, it means that num is odd. oct23_2017_APSLHL_partialSum(4, 7, 9) → 4 oct23_2017_APSLHL_partialSum(3, 8, 2) → 13 oct23_2017_APSLHL_partialSum(1234, 6, 5) → 1240 ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 250
Copyright Nick Parlante 2017 - privacy