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

 

feb13_2020_P1SLHL_funnyProduct


Write a method that returns the "funny product" of two positive integers with the same number of digits. As a precondition you may assume that num1 and num2 have the same number of digits. The "funny product" is the sum of the products of the digits in the same place-value in each number. For example, the "funny product" of 541 and 372 is 45 because 5*3+4*7+1*2 is 45. This problem may be solved with or without recursion! Look at the test data for further examples.


feb13_2020_P1SLHL_funnyProduct(541, 372) → 45
feb13_2020_P1SLHL_funnyProduct(142, 436) → 28
feb13_2020_P1SLHL_funnyProduct(993, 253) → 72

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

public int feb13_2020_P1SLHL_funnyProduct(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

Copyright Nick Parlante 2017 - privacy