Sha256: 97a46208250dbabf1331487df74e8b367bfe7a480c8f483d32f3e1e8182d7c0f

Contents?: true

Size: 496 Bytes

Versions: 146

Compression:

Stored size: 496 Bytes

Contents

/**
* Here is an example solution for the DifferenceOfSquares exercise
*/
component {
	
	function squareOfSum( number ) {
		var i = 0
		var accumulator = 0;
		while( ++i <= number ) {
			accumulator += i;
		}
		return accumulator^2;
	}
	
	 function sumOfSquares( number ) {
		var i = 0
		var accumulator = 0;
		while( ++i <= number ) {
			accumulator += i^2;
		}
		return accumulator;
	}
	
	 function differenceOfSquares( number ) {
		return squareOfSum( number ) - sumOfSquares( number );
	}
	
}

Version data entries

146 entries across 145 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/cfml/exercises/difference-of-squares/Solution.cfc
trackler-2.2.1.179 tracks/cfml/exercises/difference-of-squares/Solution.cfc
trackler-2.2.1.178 tracks/cfml/exercises/difference-of-squares/Solution.cfc
trackler-2.2.1.177 tracks/cfml/exercises/difference-of-squares/Solution.cfc
trackler-2.2.1.176 tracks/cfml/exercises/difference-of-squares/Solution.cfc
trackler-2.2.1.175 tracks/cfml/exercises/difference-of-squares/Solution.cfc
trackler-2.2.1.174 tracks/cfml/exercises/difference-of-squares/Solution.cfc
trackler-2.2.1.173 tracks/cfml/exercises/difference-of-squares/Solution.cfc
trackler-2.2.1.172 tracks/cfml/exercises/difference-of-squares/Solution.cfc
trackler-2.2.1.171 tracks/cfml/exercises/difference-of-squares/Solution.cfc
trackler-2.2.1.170 tracks/cfml/exercises/difference-of-squares/Solution.cfc
trackler-2.2.1.169 tracks/cfml/exercises/difference-of-squares/Solution.cfc
trackler-2.2.1.167 tracks/cfml/exercises/difference-of-squares/Solution.cfc
trackler-2.2.1.166 tracks/cfml/exercises/difference-of-squares/Solution.cfc
trackler-2.2.1.165 tracks/cfml/exercises/difference-of-squares/Solution.cfc
trackler-2.2.1.164 tracks/cfml/exercises/difference-of-squares/Solution.cfc
trackler-2.2.1.163 tracks/cfml/exercises/difference-of-squares/Solution.cfc
trackler-2.2.1.162 tracks/cfml/exercises/difference-of-squares/Solution.cfc
trackler-2.2.1.161 tracks/cfml/exercises/difference-of-squares/Solution.cfc
trackler-2.2.1.160 tracks/cfml/exercises/difference-of-squares/Solution.cfc