From e794020d8b881ede726338be50eaa461a134889f Mon Sep 17 00:00:00 2001 From: Charles Cabergs Date: Sun, 20 Jun 2021 20:10:05 +0200 Subject: Refactoging julia problems with function chainning --- julia/006-sum_square_difference.jl | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'julia/006-sum_square_difference.jl') diff --git a/julia/006-sum_square_difference.jl b/julia/006-sum_square_difference.jl index 39e5df8..fd5829d 100644 --- a/julia/006-sum_square_difference.jl +++ b/julia/006-sum_square_difference.jl @@ -12,9 +12,6 @@ # numbers and the square of the sum. ### -const count = 100 - -sum_of_squares = sum(x ^ 2 for x in 1:count) -square_of_sum = sum(1:count) ^ 2 - -println(square_of_sum - sum_of_squares) +const COUNT = 100 +result = sum(1:COUNT) ^ 2 - sum(x ^ 2 for x in 1:COUNT) +println(result) -- cgit