This commit is contained in:
David Doblas Jiménez 2022-10-05 20:20:48 +02:00
parent 854a99118f
commit d42df4943d

View File

@ -22,11 +22,13 @@ function Problem6()
Find the difference between the sum of the squares of the first one Find the difference between the sum of the squares of the first one
hundred natural numbers and the square of the sum. Statement =# hundred natural numbers and the square of the sum. Statement =#
n = 100 n = 100
square_of_sum = sum(i for i in (1:n))^2 square_of_sum = sum(i for i = 1:n)^2
sum_squares = sum(i^2 for i in 1:n) sum_squares = sum(i^2 for i = 1:n)
diff = square_of_sum - sum_squares ans = square_of_sum - sum_squares
return diff
return ans
end end