Sha256: 9fc47559e526808babd471880bf0dc0fad05674f20847adff40185f6c47ff239
Contents?: true
Size: 375 Bytes
Versions: 180
Compression:
Stored size: 375 Bytes
Contents
module BookKeeping VERSION = 3 end class Squares attr_reader :max def initialize(max) @max = max end def square_of_sum sum = 0 (1..max).each do |i| sum += i end sum**2 end def sum_of_squares sum = 0 (1..max).each do |i| sum += i**2 end sum end def difference square_of_sum - sum_of_squares end end
Version data entries
180 entries across 180 versions & 1 rubygems