Problem: Sum of Squares


Problem Statement

The sum of squares is the sum of a sequence of numbers up to a specified integer. For example, the sum of squares from 1 to 5 should be 55 because 12 + 22 + 32 + 42 + 52 = 55.

Given start and end values as integers, write a function that returns the sum of squares.

Definition

Class

public class SumUp { public int sumSquares(int low, int high) { // TODO: fill in sumSquares } }

Constraints

Hint

Examples

  1. 1 1
    Returns: 1

  2. -5 0
    Returns: 55

Comments?