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

 

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

Write a method that returns the sum of all the entries in a multiplication table from 1*1 up to and including x*y. For example, if x=3 and y=2, return 18 since 1*1+1*2+1*3+2*1+2*2+2*3=18. If x=2 and y=2, return 9 since 1*1+1*2+2*1+2*2=9. It would help you to understand this problem if you wrote a partial multiplication table out on paper! Then look at the examples explained above, and the results of the test data. That should help! Note that x and y must both be positive, but they can be bigger than 10. However, they WILL be small enough that the total will not be too big to be stored as an integer.


ddd1SumTimesTable(1, 1) → 1
ddd1SumTimesTable(18, 2) → 513
ddd1SumTimesTable(22, 3) → 1518

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

public int ddd1SumTimesTable(int x, int y) { }

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: 290

Copyright Nick Parlante 2017 - privacy