From c2eb96f50dce32c2c3c889f10b3c09564f8b8936 Mon Sep 17 00:00:00 2001 From: TurinTech Bot Date: Thu, 18 Jul 2024 09:58:15 +0000 Subject: [PATCH] Artemis Changes --- src/control/double.cc | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/control/double.cc b/src/control/double.cc index bb9dba1..d657d33 100644 --- a/src/control/double.cc +++ b/src/control/double.cc @@ -5,16 +5,12 @@ * * @param n * @return the sum of all values squared from 0 to n - */ + */ long DoubleForLoop::SumSquare(int n) { long sum = 0; for (int i = 0; i < n; i += 1) { - for (int j = 0; j < n; j += 1) { - if (i == j) { - sum = sum + (long) (i * j); - } - } + sum += (long)(i * i); } return sum; } @@ -98,4 +94,4 @@ DoubleForLoop::SumMatrix(std::vector> matrix) { } } return sum; -} +} \ No newline at end of file