EBAS5CYZ7I527VZKTHQHZVGH32XFRNE54B5EAYZ3WKNXECMUP2GAC
// Package diffsquares is for searchnig the difference between the
// square of the sum and the sum of the squares for the first N natural numbers.
package diffsquares
// SquareOfSum returns the square of the sum of first N numbers.
func SquareOfSum(N int) int {
var ret int
for i := 1; i <= N; i++ {
ret += i
}
return ret * ret
}
// SumOfSquares returns the summary of the square of first N numbers.
func SumOfSquares(N int) int {
var ret int
for i := 1; i <= N; i++ {
ret += i * i
}
return ret
}
// Difference returns the difference between SquareOfSum and SumOfSquare for N.
func Difference(N int) int {
return SquareOfSum(N) - SumOfSquares(N)
}